Does anyone have an Excel VBA function which can return the column letter(s) from a number?
For example, entering 100 should return CV.
CV
If you'd rather not use a range object:
Function ColumnLetter(ColumnNumber As Long) As String Dim n As Long Dim c As Byte Dim s As String n = ColumnNumber Do c = ((n - 1) Mod 26) s = Chr(c + 65) & s n = (n - c) \ 26 Loop While n > 0 ColumnLetter = s End Function