convert column number to letter
Try this User Defined Function
Function GetColLet(ColNumber As Integer) As String
GetColLet = Left(Cells(1, ColNumber).Address(False, False), _
1 - (ColNumber 26))
End Function
usage is =GetColLet(25) will return Y
Can be called from a Sub
Sub getlet()
Dim numcol As Integer
numcol = InputBox("enter a number")
MsgBox "The column is " & GetColLet(numcol)
End Sub
Gord Dibben Excel MVP
On 24 Oct 2005 12:29:55 -0700, "lvcha.gouqizi"
wrote:
If I know a cell's column number is 25, how can I know what letter its
column represent? Just like that, the column 2 is actually column "B".
Thanks.
|