Hello:
I am attempting to separate the contents of a column of cells using the "left" function. Specifically, I have a column of data such as "2Q 2010" that I need to split into a column for the quarter and a column for the year. I have constructed a Do...While loop to perform this function as long as there are row entries.
My data is constructed as follows:
OA | OB | OC
1 QTR/Yr | Quarter | Year
2 2Q 2010
Below is my code so far, it runs without error, but does not produce the desired values in the Quarter and Year columns. I would appreciate any suggestions.
Range("OB2").Activate
Do While IsEmpty(ActiveCell.Offset(0, 1)) = False
ActiveCell.Formula = "Left(1,ActiveCell.Offset(0,-1))"
ActiveCell.Offset(1, 0).Select
Loop
Range("OC2").Activate
Do While IsEmpty(ActiveCell.Offset(0, 1)) = False
ActiveCell.Formula = "Right(4,ActiveCell.Offset(0,-2))"
ActiveCell.Offset(1, 0).Select
Loop
Thanks for any help,
cdukes
I am attempting to separate the contents of a column of cells using the "left" function. Specifically, I have a column of data such as "2Q 2010" that I need to split into a column for the quarter and a column for the year. I have constructed a Do...While loop to perform this function as long as there are row entries.
My data is constructed as follows:
OA | OB | OC
1 QTR/Yr | Quarter | Year
2 2Q 2010
Below is my code so far, it runs without error, but does not produce the desired values in the Quarter and Year columns. I would appreciate any suggestions.
Range("OB2").Activate
Do While IsEmpty(ActiveCell.Offset(0, 1)) = False
ActiveCell.Formula = "Left(1,ActiveCell.Offset(0,-1))"
ActiveCell.Offset(1, 0).Select
Loop
Range("OC2").Activate
Do While IsEmpty(ActiveCell.Offset(0, 1)) = False
ActiveCell.Formula = "Right(4,ActiveCell.Offset(0,-2))"
ActiveCell.Offset(1, 0).Select
Loop
Thanks for any help,
cdukes
Last edited: