Get Column Letter

B

BB Ivan

In a procedure, how can I get the letter of a referenced column rather than
it's number?
 
B

BB Ivan

Thanks. I was hoping there was a property not listed in the Help Files, but
this works great.
 
G

Gord Dibben

In a procedure, call this function.

Function GetColLet(ColNumber As Integer) As String
GetColLet = Left(Cells(1, ColNumber).Address(False, False), _
1 - (ColNumber > 26))
End Function

Sub test()
MsgBox "this is column " & GetColLet(ActiveCell.Column)
End Sub


Gord Dibben MS Excel MVP
 
M

MyVeryOwnSelf

Only works up to column Z.

Right... my bad.

(I cancelled the article after posting it, but apparently it escaped into
the world anyhow. Next time, I'll post a retraction too.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top