Von Pookie
MrExcel MVP
- Joined
- Feb 17, 2002
- Messages
- 13,686
I have a userform with 10+ textboxes in which the user will enter information to be entered into the spreadsheet when clicking a button.
There are 2 boxes where I would like to limit what can be entered in them.
I can figure it out for cells, but can't seem to get it to work for textboxes.
For one box, they will be entering zip codes. I would like to limit this to only numbers, and 5 characters in the box.
The other box is a little trickier. It's for a phone number. By searching the board, I found some code that changes the number entered into (###) ###-#### format. However, this only works if a whole number is entered (ex. 1234567890). I've tried getting it to also format this way if a number is entered as 123-456-7890 or 123/456/7890, but can't seem to get it. I would also like to be able to limit the number of characters in this box to either 10 or 12 (depending on if I can get it to work around having to enter as a 10-digit whole number).
If anyone could shed some light onto this, t'would be quite appreciated.
Thankees, and good night
There are 2 boxes where I would like to limit what can be entered in them.
I can figure it out for cells, but can't seem to get it to work for textboxes.
For one box, they will be entering zip codes. I would like to limit this to only numbers, and 5 characters in the box.
The other box is a little trickier. It's for a phone number. By searching the board, I found some code that changes the number entered into (###) ###-#### format. However, this only works if a whole number is entered (ex. 1234567890). I've tried getting it to also format this way if a number is entered as 123-456-7890 or 123/456/7890, but can't seem to get it. I would also like to be able to limit the number of characters in this box to either 10 or 12 (depending on if I can get it to work around having to enter as a 10-digit whole number).
If anyone could shed some light onto this, t'would be quite appreciated.
Thankees, and good night