Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert column letter to number?
I'm writing a Sub that accepts a column letter as input in a UserForm. I
would like to convert this column letter to a column number for use in my code. How is this done? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert column letter to number?
You can try this Frank
Dim str As String str = "D" MsgBox Columns(str).Column -- Regards Ron de Bruin http://www.rondebruin.nl "Frank Marousek" wrote in message ... I'm writing a Sub that accepts a column letter as input in a UserForm. I would like to convert this column letter to a column number for use in my code. How is this done? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert column letter to number?
Why can't you use the letter?
strInput = Inputbox("Letter") Range(strInput & 1).Select Cells(1, strInput).Select otherwise, if the activesheet is a worksheet then use this: ColumnNumber = Range(strInput & 1).Column -- Charles Chickering "A good example is twice the value of good advice." "Frank Marousek" wrote: I'm writing a Sub that accepts a column letter as input in a UserForm. I would like to convert this column letter to a column number for use in my code. How is this done? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert column letter to number?
Hi
This sub will return 36 Public Sub tester() Dim Letter As String Letter = "AJ" MsgBox Columns(Letter & ":" & Letter).Column End Sub Replace letter with your UserForm input. regards Paul Frank Marousek wrote: I'm writing a Sub that accepts a column letter as input in a UserForm. I would like to convert this column letter to a column number for use in my code. How is this done? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert column letter to number?
Why can't you use the letter?
Using the letter works fine. It was a rookie mistake. I was getting a "Type mismatch" error which I thought was being caused because I was feeding a string into where an integer was expected, but it turns out that error was being caused by something else. Thank you! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
convert column number to letter | Excel Programming | |||
convert column number to letter | Excel Programming | |||
convert column number to letter | Excel Programming | |||
convert column number to letter | Excel Programming |