O
Otto Moehrbach
Excel 2007, Win 7 64-bit
I have the following code. Note that this is a self-standing macro. This
macro is not called by any other macro. It is executed by a Forms button.
There are 3 FOR loops, none nested
Sub SortByName()
With Sheets("SortSht")
Copy & Paste
Set rColA =...................
For cc = rColA.Count To 2 Step -2
Stuff
Next cc
For cc = rColA.Count To 1 Step -1
Stuff
Next cc
For cc = rColA.Count To 1 Step -1
Stuff
Next cc
End With
End sub
I get an error with the bottom FOR loop. Error reads "For control variable
already in use". I change the variable in that FOR loop to "c". I get the
same identical error but now in the second FOR loop. What is wrong with
this code? Thanks for your time. Otto
I have the following code. Note that this is a self-standing macro. This
macro is not called by any other macro. It is executed by a Forms button.
There are 3 FOR loops, none nested
Sub SortByName()
With Sheets("SortSht")
Copy & Paste
Set rColA =...................
For cc = rColA.Count To 2 Step -2
Stuff
Next cc
For cc = rColA.Count To 1 Step -1
Stuff
Next cc
For cc = rColA.Count To 1 Step -1
Stuff
Next cc
End With
End sub
I get an error with the bottom FOR loop. Error reads "For control variable
already in use". I change the variable in that FOR loop to "c". I get the
same identical error but now in the second FOR loop. What is wrong with
this code? Thanks for your time. Otto