Column Number from Column Letter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the column letter of a cell and I need the column number. I know this
must be simple but I cannot figure out how to do it.
 
In a cell:
=COLUMN(A1)

In VBA:
iColNum = Worksheets("Sheet1").Range("A1").Column

- Jon
 
Robert,

One way is to use the Column property of the Range object. For example, to
determine the column number of the column "AY",

Sub test()
Dim iColumn As Integer
iColumn = Range("AY1").Column
End Sub
 
Function ColLetterToNumber(Letter As String) As Long
ColLetterToNumber = Columns(Letter).Column
End Function
 

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

Back
Top