ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Column Number from Column Letter (https://www.excelbanter.com/excel-programming/390974-column-number-column-letter.html)

Robert[_32_]

Column Number from Column Letter
 
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.
--
Robert Hill


Jon Peltier

Column Number from Column Letter
 
In a cell:
=COLUMN(A1)

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

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Robert" wrote in message
...
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.
--
Robert Hill




Mike H

Column Number from Column Letter
 
Try:-

=COLUMN(E1)

Would return 5.

Mike

"Robert" wrote:

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.
--
Robert Hill


Vergel Adriano

Column Number from Column Letter
 
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


--
Hope that helps.

Vergel Adriano


"Robert" wrote:

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.
--
Robert Hill


vbapro[_2_]

Column Number from Column Letter
 
Function ColLetterToNumber(Letter As String) As Long
ColLetterToNumber = Columns(Letter).Column
End Function


"Robert" wrote:

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.
--
Robert Hill


Dave Peterson

Column Number from Column Letter
 
msgbox activesheet.cells(1,YourColumnLetterHere).column



Robert wrote:

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.
--
Robert Hill


--

Dave Peterson


All times are GMT +1. The time now is 03:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com