ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form Controls (https://www.excelbanter.com/excel-programming/275617-user-form-controls.html)

Zaid Qureshi

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
.



All times are GMT +1. The time now is 08:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com