View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dee Sperling[_2_] Dee Sperling[_2_] is offline
external usenet poster
 
Posts: 29
Default Validate User Input in Dialog box

I'm using the following to prompt the user for the starting 5 digit code in a
list.

StartingNum = Application.InputBox("Enter the 5 digit number", "Enter
Starting Number (5 digits only)")

Once I get the value, I put it in the approprate cell, increment it by one,
and keep cascading to the cells below, based on a value in another cell on
the same row, different column.

This works great, but I was wondering if there was a way to
1) Prevent the user from canceling out of the Input box.
2) Validate the input value so that if the user enters other than exactly 5
digits, it will generate an info box and force them to re-input.
3) Not error out if a letter is entered in the box. The user knows that
they are only supposed to enter digits, but if they do a typo, it goes to
Debug, and it would be better if the program would simply dicard the value
and present the input box again.

Thanks for any suggestions,
Dee