Limit characters in an Input Box

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.
 
D

Die_Another_Day

Do
var1 = InputBox("Testing","Test")
Loop Until Len(var1) = 3

HTH

Charles Chickering
 
N

NickHK

Or you could just make a simple UserForm and control exactly want can
happen.

NickHK
 

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

Similar Threads

Validate User Input in Dialog box 3
Cancel (Dismiss) Input Box 1
Limit size of number input 2
Combobox filtering 2
Limit textbox to 255 characters 2
Length of integer 4
Add text per user input 1
Limit characters 3

Top