Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
i have a textbox that has to have a number entered into it that is 0 & <10. i can quite easily write a longish routine in the textbox_change event procedure using isnumeric & len() to test each new character that the user inputs into the textbox ; but is there a quicker solution? Thanks in advance Jason |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jason,
1) Can you wait until the user clicks a commandbutton (OK/Done button) and then validate the textbox. 2) Can you use the Textbox_Exit event?(see code below) I don't know if your design fits this usage (requires the user to hit enter or tab to another control). Troy Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim sValue As String Dim dblValue As Double sValue = Me.TextBox1.Value If IsNumeric(sValue) Then dblValue = CDbl(sValue) If dblValue <= 0 Or dblValue = 10 Then MsgBox "Please enter a number between 0 and 10" Cancel = True End If Else MsgBox "Please enter a numeric value" Cancel = True End If End Sub "jason" wrote in message om... Hello All, i have a textbox that has to have a number entered into it that is 0 & <10. i can quite easily write a longish routine in the textbox_change event procedure using isnumeric & len() to test each new character that the user inputs into the textbox ; but is there a quicker solution? Thanks in advance Jason |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculate Textbox value based on another textbox value.doc | Excel Discussion (Misc queries) | |||
Calculate Textbox value based on another textbox value | Excel Discussion (Misc queries) | |||
Excel 2007 Textbox Locking | Excel Discussion (Misc queries) | |||
locking formula in cells in without locking whole sheet | Excel Discussion (Misc queries) | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |