MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Preventing a user from entering text into a value field in a UserForm


Posted by Dominic on May 29, 2001 10:59 AM

I want to specify that certain fields only work with values, and if a user enters a value, presses calculate on my form that a message is returned saying this is not a value


Posted by Connie on May 29, 2001 11:58 AM

Dominic
I believe you can accomplish what you need to by using going to the menu Data>Validation. This function will allow you to specify the input criteria acceptable from the user. In your case, you'll want to choose (under the data validation dialog box, Allow:) "Whole Number". From there, you can specify a range, for example, a minimum of 1 and maximum of 5000. If the user tries to enter text, they will get an error message. You can even specify what you want the error message to say by clicking on the Error Alert tab and filling your message in. If the numeric options are very limited, you could also choose "List" from the "Allow" box, and put in the only valid choices, i.e. "1,2,3". When you use List, you can also make those choices available in a drop-down cell so the user doesn't have to type them. Hope this helps.

Posted by Dominic on May 29, 2001 12:21 PM

Thanks, An excel function that I did not know