Date format using VBA

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I would like to format a range of cells using VBA to only
accept the mm/dd/yy date format. Also, is it possible to
pre-populate each of those cells where the user would
see " / / " and they just fill in the spaces?
 
Sounds like a bad idea. Dates are not stored as mm/dd/yy - they are stored
as a number of days from a base date. So any valid date format is
acceptable - Excel will see this as a date and generate the date serial.
You can format the cell to show mm/dd/yy format - but it is counter
productive to try to force the user to enter the data in a specific format.

If you put a zero in the cell it will display as

00/00/00
But that is about as close to / / as you can get unless you either put in
/ / manually or produced it with a formula and in either case, it would
get overwritten by the user making an entry.
 
Back
Top