Using ColumnNumber in Range syntax
columns(54).Select
replace 54 with your integer/long variable.
--
Regards,
Tom Ogilvy
"Hari Prasadh" wrote in message
...
Hi,
If I want to select Column A programmatically then
Columns(A:A).select would work.
Suppose I have a variable column to select and the counter for this column
number is from a FOR loop then how do I use this counter to select that
column.
For ColumnCounter = 4 to 54
Columns (ColumnCounter & ":" & ColumnCounter).select
'do required stuff
'do required stuff
Next ColumnCounter
Now when i run the above, I would get an error as within Columns syntax
above, ColumnCounter should be a string (from "A" to "IV").
So, how do I Translate/Map Column Numbers in to equivalent column
letter/s.
Can that be done programmatically?
(One way is in my Personal.xls I can build a mapping with column A
containing numbers from 1 to 256 and corresponding rows in column B having
A
to IV and then do a vlookup of ColumnCounter against A1 to B256. But is
there a more efficient way?)
Thanks a lot,
Hari
India
|