ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Limit characters in an Input Box (https://www.excelbanter.com/excel-programming/371181-limit-characters-input-box.html)

jking80

Limit characters in an Input Box
 
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.

Die_Another_Day

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.



NickHK

Limit characters in an Input Box
 
Or you could just make a simple UserForm and control exactly want can
happen.

NickHK

"jking80" wrote in message
...
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.





All times are GMT +1. The time now is 10:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com