![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 06:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com