Cyberdude
09-28-2005, 02:10 PM
I have a series of variables (Col1, Col2, ...) for column letters. If I substitute a variable for the column letter:
Range(Col1 & 3).Select
it works just fine.
I would like to create a loop that looks something like:
Dim Col1 As String, Col2 As String
Col1 = "A"
Col2 = "F"
For N=1 To 2
Range("Col" & N & N + 2).Clear
Next N
This of course doesn't work because it would create something like:
Range(Col12).Clear
In fact it might create something like:
Range("Col"12).Clear (I'm not sure)
What I need is something like the Excel "Indirect" function, I think.
Range(Indirect("Col" & N) & N + 2).Clear
In any case I'm going crazy trying to figure it out. :banghead:
Any ideas?
Range(Col1 & 3).Select
it works just fine.
I would like to create a loop that looks something like:
Dim Col1 As String, Col2 As String
Col1 = "A"
Col2 = "F"
For N=1 To 2
Range("Col" & N & N + 2).Clear
Next N
This of course doesn't work because it would create something like:
Range(Col12).Clear
In fact it might create something like:
Range("Col"12).Clear (I'm not sure)
What I need is something like the Excel "Indirect" function, I think.
Range(Indirect("Col" & N) & N + 2).Clear
In any case I'm going crazy trying to figure it out. :banghead:
Any ideas?