View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default if until requirement met

An alternativel to Norman's suggestion is to go with Data Validation. Someone
can probably come up with a more elegant formula than mine:-

1) Select the Data menu
2) Select Validation
3) Select the Custom option from the Allow dropdown list
4) Enter the following formula in the formula window. Unfortunately, you
will have to type it in. The window won't accept copy and paste.

=AND(LEN(A1) = 5,
ISNUMBER(VALUE(LEFT(A1,2))),MID(A1,3,1)="/",ISNUMBER(VALUE(RIGHT(A1,2))))

5) Enter suitable text for Input Message and Error Alert. See these tabs.

Regards,
Greg

"stefan via OfficeKB.com" wrote:


Hi,
the user is required to enter data in one cell as ##/## i.e. 04/04
I would like to restrict the cell input to that and prompt the user if/how to
enter data.
I also want to embed this into a makro.
something like
If cellvalue < "##/##"
then msgbox "Please enter date in this format ##/## i.e. 04/04"
Else
msgbox "Good Format"
...and continue with the code once the data was inot correctly.
i cant figure out how to do this. Thank you for your help.
stefan


--
Message posted via http://www.officekb.com