force text/numbers in text box

  • Thread starter Thread starter pswanie
  • Start date Start date
P

pswanie

is there a way to force my user to enter only numbers in a textbox?
and in other only letters?
theres quite a few textboxe's

some thing like this perhaps?

with me.
textbox1
textbox2
textbox3
..numbers.only

thanx all
 
Hi,

Right click each textbox, view code and paste this in to ensure numbers
only. Remove 'Not' to ensure letters only, Don't forget to change the name of
the text box as appropriate.

Private Sub TextBox1_Change()
If Not IsNumeric(TextBox1.Value) And TextBox1.Value <> vbNullString Then
MsgBox "Sorry, only numbers/letters allowed"
TextBox1.Value = vbNullString
End If
End Sub


Mike
 
thanx rick...

one more Q. how will i go to the last cell in column b and make that the
caption for label1?
 
Back
Top