View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Limit characters in an Input Box

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

HTH

Charles Chickering

jking80 wrote:
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.