View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Convert text to number

The number entered should be a number.

Sub qwer()
Dim asdf as Long
asdf = InputBox("enter a number")
Range("H1").Value = asdf
End Sub

H1 is number 13 after running the above and entering 13 in the inputbox.


Gord Dibben MS Excel MVP


On Thu, 25 Oct 2007 18:43:02 -0700, GrantW
wrote:

I am using an input box to assign a number to a variable. e.g
EC = InputBox("Enter the number of the Position Description from the list
below." )

However, I think if the input is say 13, the variable stores this as a text
"13".
1. Am I correct in assuming this?
2. Can I convert this from text to a number with code?

Any assistance would be appreciated.