Numeric Textbox
-
Hi all! I´m newbie using Vbasic. I need to make a macro for Excel, which shows a form asking for a numeric value in a Textbox. I convert the Textbox content to long with CLng() function.
Dim longval As Long longval=CLng(TheTextBox.Text)
But this function crashes if the content of the textbox is alphanumeric. How can I check that the value entered is only numeric? Is there any function like "IsDigit" or something? or Is there any Textbox property to force only numeric content? Thanks a lot. :wtf: -
Hi all! I´m newbie using Vbasic. I need to make a macro for Excel, which shows a form asking for a numeric value in a Textbox. I convert the Textbox content to long with CLng() function.
Dim longval As Long longval=CLng(TheTextBox.Text)
But this function crashes if the content of the textbox is alphanumeric. How can I check that the value entered is only numeric? Is there any function like "IsDigit" or something? or Is there any Textbox property to force only numeric content? Thanks a lot. :wtf:If IsNumeric( TheTextBox.Text ) Then longval = CLng( TheTextBox.Text ) Else longval = SOME_DEFAULT_VALUE End If - dougw48 dwright@tdci.com
-
If IsNumeric( TheTextBox.Text ) Then longval = CLng( TheTextBox.Text ) Else longval = SOME_DEFAULT_VALUE End If - dougw48 dwright@tdci.com