Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Karina K patni   on Dec 20 In MS Office Category.

  
Question Answered By: Utsav Shah   on Dec 20

I used the isnumeric feature as follows:

Private Sub textbox1_Change()
If IsNumeric(TextBox1.Value) = False Then TextBox1.Value = ""
End Sub

This eliminates the message box  and just clears the textbox whenever
anything other than a numbe is entered. And I used the maxlength
property on the ones where I wanted to limit the length.

Cool.

Plus, I figured out the Select Case feature from Hutch's answer which
I could also use to restrict answers as follows:

Select Case TextBox.Value
Case 2,4,6,8
TextBox.Value = TextBox.Value
Case Else
TextBox.Value = ""
End Select

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on text box -- integers only Or get search suggestion and latest updates.


Tagged: