Alpha to Numeral column name

D

danpt

I need a macro or function to translate alphabetic column name to numeral
column number like:
Sub alphatonumeral()
Dim alpha, numeral As Variant
alpha = UCase(InputBox(prompt:="What is the alphabetic column name?"))
' translation body will be similar to formula "=column(BA:BA)" if input
alpha is BA
numeral = 53 ' for BA
MsgBox numeral
End Sub
 
G

Gary''s Student

Sub Numerify()
Dim s As String, n As Long, r As Range
s = Application.InputBox(Prompt:="give me the letters", Type:=2)
Set r = Range(s & 1)
MsgBox (r.Column)
End Sub
 
D

danpt

Thank you, great help

Gary''s Student said:
Sub Numerify()
Dim s As String, n As Long, r As Range
s = Application.InputBox(Prompt:="give me the letters", Type:=2)
Set r = Range(s & 1)
MsgBox (r.Column)
End Sub
 
R

Rick Rothstein

If you wanted to do this directly on the worksheet without using a macro,
then you could use this formula (where your column letters are assumed to be
in A1)...

=IF(A1="","",COLUMN(INDIRECT(A1&"1")))
 

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

Top