force text/numbers in text box

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
 
M

Mike H

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
 
P

pswanie

thanx rick...

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top