View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zaid Qureshi Zaid Qureshi is offline
external usenet poster
 
Posts: 2
Default User Form Controls



(1) Use VBA code to restrict the input to numbers like so:
(assuming that the textbox is called textbox1)

if Not IsNumeric(Textbox1.Text) then
msgbox "You must only enter numbers"
TextBox1.Text = Empty
End if

(2) Set the MaxLength property of the textbox to 4 to
restrict the length to a 4 character input.


Zaid Qureshi
-----Original Message-----
Hi all,

Is it possible within a excel user form to set a text box
to:

1) only accept numbers
2) only accept a set number of characters

Ie the user can only input a 4 number code.


Ben E
.