Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Note: There isn't a reason I can think of to use this because excel can accept column numbers, but here is the function regardless.

References:

https://www.excelcampus.com/vba/find-last-row-column-cell/

https://stackoverflow.com/questions/12796973/function-to-convert-column-number-to-letter/12797190#12797190

https://superuser.com/questions/1414357/clear-cells-to-right-of-selected-cell-in-excel-vba-cant-guess-column-letter-h?noredirect=1#comment2134745_1414357

Finding Last Used Column or Row


Code:

Function Col_Letter(lngCol As Long) As String
Dim vArr
vArr = Split(Cells(1, lngCol).Address(True, False), "$")
Col_Letter = vArr(0)
End Function

Sub Range_End_Method()
Dim lCol As Long
lCol = Cells(1, Columns.Count).End(xlToLeft).Column

MsgBox "Column Letter" & Col_Letter(lCol)

End Sub


  • No labels