Hi Amit,
You can use the KeyPress event of the TextBox to check each character as
it's entered and either accept it or reject it. In the example below,
numbers, the % symbol and backspace are allowed, while all other characters
are cancelled.
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 8, 37, 48 To 57
''' Backspace, % and numbers are all OK
Case Else
''' Cancel all other characters.
KeyAscii = 0
End Select
End Sub
Even with this event in place you'll still need to do some additional
validation in your Submit button click event to trap for the few situations
where the user can still enter invalid data, like 12%3 or just %.
--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/
* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
"amit" wrote in message
...
hi - I have a user entry text box to enter a % value...and a submit
command
button which mutiplies the entry with another number. i'm able to take
inputs
both as % and as whole numbers and based on the input..either remove the %
or
if whole number then divide by 100. i would like to put a change event
which
catches any input other than numers or %....valid entries would be 100% or
100.....need help with being able to catch entries like rree or rr%
any help much appreciated.
regards,
Amit