PC Review


Reply
Thread Tools Rate Thread

convert letters to numbers

 
 
JT
Guest
Posts: n/a
 
      3rd Jun 2010
How do I convert letters to numbers with VBA. On one of the sheets in my
macro there is a date field. The user indicates the date field by entering
"F" or "B" or "L" in a specific cell on another sheet. Some users will enter
1 or 2 or 4 and it is not a problem. However, some users enter letters and I
need to convert those letters to the appropriate number, so I know which
column contains dates.

Thanks for the help.

--
JT
 
Reply With Quote
 
 
 
 
GS
Guest
Posts: n/a
 
      3rd Jun 2010
JT wrote on 6/3/2010 :
> How do I convert letters to numbers with VBA. On one of the sheets in my
> macro there is a date field. The user indicates the date field by entering
> "F" or "B" or "L" in a specific cell on another sheet. Some users will enter
> 1 or 2 or 4 and it is not a problem. However, some users enter letters and I
> need to convert those letters to the appropriate number, so I know which
> column contains dates.
>
> Thanks for the help.


If the letters represent the column label:
DateColumn = Columns("F")

where "A" is column 1, "B" is column 2, and so on.

HTH

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      3rd Jun 2010

' Jun 08, 2002 - Created - Jim Cone
' Returns the number of the column from the provided column letters.
' The string argument is passed ByVal so a variant can be used.
'==================================================
Function GetColumnNumber(ByVal ColLetters As String) As Long
On Error GoTo BadColumn
GetColumnNumber = Columns(ColLetters).Column
Exit Function
BadColumn:
Beep
GetColumnNumber = 0
End Function
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware





"JT" <(E-Mail Removed)>
wrote in message
How do I convert letters to numbers with VBA. On one of the sheets in my
macro there is a date field. The user indicates the date field by entering
"F" or "B" or "L" in a specific cell on another sheet. Some users will enter
1 or 2 or 4 and it is not a problem. However, some users enter letters and I
need to convert those letters to the appropriate number, so I know which
column contains dates.
Thanks for the help.
--
JT
 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      3rd Jun 2010
How about:

Sub dural()
Dim s As String
s = Application.InputBox(prompt:="enter a column letter:", Type:=2)
S2 = s & ":" & s
n = Range(S2).Column
MsgBox (n)
End Sub
--
Gary''s Student - gsnu201003


"JT" wrote:

> How do I convert letters to numbers with VBA. On one of the sheets in my
> macro there is a date field. The user indicates the date field by entering
> "F" or "B" or "L" in a specific cell on another sheet. Some users will enter
> 1 or 2 or 4 and it is not a problem. However, some users enter letters and I
> need to convert those letters to the appropriate number, so I know which
> column contains dates.
>
> Thanks for the help.
>
> --
> JT

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert numbers to letters in excel alias Microsoft Excel Worksheet Functions 1 25th Mar 2009 01:02 PM
Convert Letters to Numbers? DS Microsoft Excel Programming 8 21st Oct 2008 04:57 PM
convert letters to numbers g75 Microsoft Excel Charting 9 3rd Feb 2006 04:33 PM
How to convert numbers to corresponding letters? Ex: 123 to abc =?Utf-8?B?anBsYXpvbGE=?= Microsoft Excel Misc 4 29th Jun 2005 09:29 AM
How to convert numbers to letters =?Utf-8?B?Q2xhdWRpbyBNaWxsYXBlbA==?= Microsoft Excel Misc 1 23rd May 2004 09:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:45 PM.