Date & Time formatting - Change any date / time entry to standard format used by conditional formatting (VBA)

fvdk

New Member
Joined
Aug 18, 2011
Messages
23
For a new project I'm working on a form in Excel. One of the field that need to be filled in on the form is time and date.

For this fields I use data validation for Time and Date to make sure the users enter a time and for the other field a date. However in this valition the time needs to be entered as HH:MM (14:30) and the date as DD-MM-YYYY (24-10-2011).

One of the comments from the users was that they want any time /date format to be accepted. How to do this and still keep the validation check: i.e. change the time / date formats that are entered to the standard time format:

So change Time:
HH-MM
HHMM
HH.MM
to
HH:MM

and change Date:
DD:MM:YYYY
DDMMYYYY
DD.MM.YYYY
to
DD-MM-YYYY

Is there any function in VBA that can help with this?

Many thanks in advance :)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,224,514
Messages
6,179,223
Members
452,896
Latest member
IGT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top