' 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