This is a simple macro to know the letter of a column based on its number, for instance, I want to know the letter of the column 27.And vice versa, for instance, I want to know the number of the column AA. Usually, I combine with other macros, for example, I want to copy the cells of the last column but this last column is always updated with new data.
When I use the macro ?
To know the letter or the number particularly when the column has a high number (for instance 76, what is the corresponding letter ?) or letter (for instance DZ, what is the corresponding number ?).
How to create the macro ?
Read How to create, edit, hide and select a macro in an excel report
How to create the button to associate it with the macro ?
Read How to create a button and associated it to a macro in an excel report
How is the macro ?
Copy the code below and paste it into your macro. You will see my comments in green if exist so follow the help to adapt to your need.
To know the letter of a column:
Sub test()
Dim ColumnNumber As Long
Dim ColumnLetter As String
' change 7 by a number
ColumnNumber = 7
ColumnLetter = Split(Cells(1, ColumnNumber).Address, "$")(1)
MsgBox "Column " & ColumnNumber & " = Column " & ColumnLetter
End Sub
To know the number of a column:
Sub test()
Dim ColumnNumber As Long
Dim ColumnLetter As String
' change G by a letter
ColumnLetter = "G"
ColumnNumber = Range(ColumnLetter & 1).Column
MsgBox "Column " & ColumnLetter & " = Column " & ColumnNumber
End Sub
When you are managing a team, “how to be a good manager” is the “must”...
As manager, I am doing many reports, even when I was an ITIL consultant, I still needed to do many reports...
ITIL V3 is going to be obsolete...
Managing an IT service when I start a new company is not an easy task, particularly true, if the service...