Limit characters in an Input Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a program in VBA where a user enteres the first 3 digits of
the zip code and the program looks in a column of data to see if the value
entered is in the column.

I need to ensure the user enters only 3 digits into the text box. How can I
do this?

I know I can just limit the high end value to 999, but that doesn't work for
the low end. Also, if the user types in only one or two digits, the program
will find those numbers in the column even though the entry is only a partial
of the number in the cell in the column.
 
Do
var1 = InputBox("Testing","Test")
Loop Until Len(var1) = 3

HTH

Charles Chickering
 

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

Back
Top