|
Subject:
|
string manipulation problem
|
|
Posted By:
|
JAMIE AVERY
|
Post Date:
|
9/21/2006 8:37:33 AM
|
Hi I have a strange problem with an Excel Macro. Part of the code should recognise if a text string begins with "The ", and if it does, moves "The " from the beginning to the end of the string.
If Left(Cells(i, 3), 4) = "The " Then Cells(i, 3).Value = Cells(i, 3) & " The" Cells(i, 3) = Right(Cells(i, 3), Len(Cells(i, 3)) - 4) End If
Now when I step through the macro using F8, it recognises the string, and moves it to the end. But when I run the macro as a whole it seems to ignore the strings it should be altering!
Can anyone help me with this please?
Jamie
|
|
Reply By:
|
JAMIE AVERY
|
Reply Date:
|
9/21/2006 9:01:52 AM
|
I have found a work around. The For...Next loop I was using had a second part that created a sheet using the contents of the cell mentioned earlier. If I separate this into two discrete For....Next loops to achieve each task then my code works.
This doesn't explain why it didn't work before, but at least it works ok now!
|
|