ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Convert Column letter to number (https://www.excelbanter.com/excel-programming/344002-convert-column-letter-number.html)

slymeat

Convert Column letter to number
 
Anybody have some code to convert a column letter to it's column number
equivalent?
--
Andrew

Toppers

Convert Column letter to number
 
Function courtesy of Chip Pearson:


Function ColumnNumber(ColLetter) As Integer
ColumnNumber = Cells(1, ColLetter).Column
End Function



"slymeat" wrote:

Anybody have some code to convert a column letter to it's column number
equivalent?
--
Andrew


Gary Keramidas

Convert Column letter to number
 
and from bob phillips
'-----------------------------------------------------------------
Function ColumnLetter(Col As Long)
'-----------------------------------------------------------------
Dim sColumn As String
sColumn = Split(Columns(Col).Address(, False), ":")(1)
ColumnLetter = sColumn
End Function


--


Gary


"Toppers" wrote in message
...
Function courtesy of Chip Pearson:


Function ColumnNumber(ColLetter) As Integer
ColumnNumber = Cells(1, ColLetter).Column
End Function



"slymeat" wrote:

Anybody have some code to convert a column letter to it's column number
equivalent?
--
Andrew




Bob Phillips[_6_]

Convert Column letter to number
 
colNum = Range(colLetter & "1").column

where colLetter is a variable with the letter(s) in it.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"slymeat" .(donotspam) wrote in message
...
Anybody have some code to convert a column letter to it's column number
equivalent?
--
Andrew




[email protected]

Convert Column letter to number
 
A simple one:
Sub Test()
colname = InputBox("Enter column")
'This is the one that does the trick
outp = Columns(colname).Column
MsgBox ("col no is " & outp)
End Sub

slymeat (donotspam) wrote:
Anybody have some code to convert a column letter to it's column number
equivalent?
--
Andrew



Kleev

Convert Column letter to number
 
Thanks to all those who answered this. I only need one, but this will help
me also.

"Toppers" wrote:

Function courtesy of Chip Pearson:


Function ColumnNumber(ColLetter) As Integer
ColumnNumber = Cells(1, ColLetter).Column
End Function



"slymeat" wrote:

Anybody have some code to convert a column letter to it's column number
equivalent?
--
Andrew



All times are GMT +1. The time now is 01:38 AM.

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