return actual column value??

spinkung

Registered User.
Local time
Today, 23:13
Joined
Dec 4, 2006
Messages
267
hi all,

i'm trying to format excel from access (vba) and am having some trouble getting the last column used in my sheet.

i have this:
Code:
ilastCol = xlSht.Cells(1, Columns.Count).End(xlToLeft).Column
...which gives me the last used column as a number but i can't use the number in a range. i.e sht.range("A1:" & ilastCol & ilastRow).

I need to return the actual column name (i.e X, AT, ZZ). I can do this by doing some kind of module which has a numerical lookup against my value but that seems too long winded.

Does anyone know of an easier way to get the col name.

Many Thanks
Spin.
 
Look up the "Cells" way of referencing ranges in excel and use that.
 
Or use the "address" property followed by some string functions to get the column letter.
 

Users who are viewing this thread

Back
Top Bottom