Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using "Right(Environ("UserName"), 1)" to pull the last character in the
username. This character happens to be a number. Since it is a string, I need to know have to convert to a numeric in order to use in a formula. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim num as Long
num = Right(Environ("UserName"), 1) Or to make it more robust Dim num as Variant num = Right(Environ("UserName"), 1) if isnumeric(num) then num = clng(num) end if -- Regards, Tom Ogilvy "WLMPilot" wrote in message ... I am using "Right(Environ("UserName"), 1)" to pull the last character in the username. This character happens to be a number. Since it is a string, I need to know have to convert to a numeric in order to use in a formula. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
CInt(Right(Environ("UserName"), 1))
-- Hope that helps. Vergel Adriano "WLMPilot" wrote: I am using "Right(Environ("UserName"), 1)" to pull the last character in the username. This character happens to be a number. Since it is a string, I need to know have to convert to a numeric in order to use in a formula. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
convert string to number | Excel Worksheet Functions | |||
Convert a number to a name string | Excel Worksheet Functions | |||
convert weekday string to number | Excel Discussion (Misc queries) | |||
Convert a String to an number | Excel Programming | |||
convert string to number | Excel Worksheet Functions |