ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Validation Help (https://www.excelbanter.com/excel-programming/419311-re-cell-validation-help.html)

a m spock

Cell Validation Help
 
How would I do it using VBA. I gave a macro which asks for date as Input from
user as a part of data collection. I need to make sure that

1. user does not leave it blank
2. user enters d-m-yy, or dd-mm-yy, or dd-mm-yyyy
3. on clicking o.k. the cell shows date as dd-mm-yyyy

any help would be much appreciated

ps: I have a opencalendar macro dionloaded and installed, but I do not know
how to call it from within another macro for date entry by selecting from
calendar display and then revert to the macro for other data entry.

"Rick Rothstein (MVP - VB)" wrote:

You are doing this at the spreadsheet level (as opposed to using VBA),
right? Why can't you just use Format Cells to force the display to that
format no matter how the user enters his/her date? Just to point out though,
you will not be able to insure the user is always putting in day followed by
month for day values less than or equal to 12 (in case that was the
motivation behind your question).

Rick

Will give it a go, thanks. Any thoughts on ensuring that a date
has format dd/mm/yyyy?

Data Validation... Custom Formula Is
=AND(A2=TRIM(A2),(LEN(A2)=8))
--
Gary''s Student - gsnu200771





All times are GMT +1. The time now is 10:20 PM.

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