I want to manipulate the existing text in a column but my existing code takes much too long to run
I am thinking that if I can find a way to first convert all the cells to c.Value = Right(c.Value, 4) & "_" & Left(c.Value, 2) without looping through every record then I can deal with the other cases using filters.
So unless you have a better solution I want to achieve the equivalent of this:
Thanks for looking,
Gavin
Code:
Sub test()
Dim myRange As Range
Dim c As Range
Set myRange = Selection
For Each c In myRange
Select Case Right(c.Value, 4)
Case strCurrentYear 'Current Year data by period
c.Value = Right(c.Value, 4) & "_" & Left(c.Value, 2)
Case Is < strCurrentYear
c.Value = "_Previous Years"
Case Else 'future years - very few records will meet this condition
c.Value = Str(Right(c.Value, 4))
End Select
Next c
End Sub
So unless you have a better solution I want to achieve the equivalent of this:
Code:
For Each c In myRange
c.Value = Right(c.Value, 4) & "_" & Left(c.Value, 2)
Next c
Gavin