Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code to convert text input to a number


Hi all,

What is the code to convert text taken from a input text box (on
form) into a number that can be used for manipulation?

Thank

--
FC
-----------------------------------------------------------------------
FCC's Profile: http://www.excelforum.com/member.php...fo&userid=3588
View this thread: http://www.excelforum.com/showthread.php?threadid=56890

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Code to convert text input to a number

Hi FCC,

Try:

Dim myValue As Double

myValue = CDbl(TextBox1.Value)


---
Regards,
Norman



"FCC" wrote in message
...

Hi all,

What is the code to convert text taken from a input text box (on a
form) into a number that can be used for manipulation?

Thanks


--
FCC
------------------------------------------------------------------------
FCC's Profile:
http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=568900



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Code to convert text input to a number

If you use the Application.InputBox instead of VBA.InputBox, you can specify
a Type:=1 argument, to limit the user to numbers. e.g.
Debug.Print VarType(Application.InputBox("Some prompt", , , , , , , 1))
5
shows that a double was returned.
You still need to check for the Cancel, which =False.

NickHK

"FCC" wrote in message
...

Hi all,

What is the code to convert text taken from a input text box (on a
form) into a number that can be used for manipulation?

Thanks


--
FCC
------------------------------------------------------------------------
FCC's Profile:

http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=568900



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Code to convert text input to a number

Ignore this as I misread your "input text box" for an input box.

NickHK

"NickHK" wrote in message
...
If you use the Application.InputBox instead of VBA.InputBox, you can

specify
a Type:=1 argument, to limit the user to numbers. e.g.
Debug.Print VarType(Application.InputBox("Some prompt", , , , , , , 1))
5
shows that a double was returned.
You still need to check for the Cancel, which =False.

NickHK

"FCC" wrote in message
...

Hi all,

What is the code to convert text taken from a input text box (on a
form) into a number that can be used for manipulation?

Thanks


--
FCC
------------------------------------------------------------------------
FCC's Profile:

http://www.excelforum.com/member.php...o&userid=35888
View this thread:

http://www.excelforum.com/showthread...hreadid=568900





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert text string to a number code ramon Excel Discussion (Misc queries) 5 April 11th 07 05:02 PM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Convert text strings to a code or number MaxNY23 Excel Worksheet Functions 15 March 23rd 06 10:47 PM
Pause code, wait for input, no input received, carry on with the code [email protected] Excel Programming 1 September 29th 05 12:19 PM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM


All times are GMT +1. The time now is 04:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"