Converting dates entered

howard

Well-known Member
Joined
Jun 26, 2006
Messages
5,973
Office Version
  1. 2019
Platform
  1. Windows
I have a spreadsheet that contains dates amongst other items. Sometimes the opperator enters the date a dd/mm/yyyy for eg 01/10/2006 and sometimes as 10/01/2006. I want all dates entered as dd/mm/yyyy.

I would like VBA code to be written that will convert all dates entered as mm/dd/yyyy that is after the current date in cell A2 (i.e todays date 07//10/2006)

for eg if the date is entered as 07/12/2006 which is after the todays date 07/10/2006, then the date must be converted to 12/07/2006.

Your assistance will be most appreciated.

Howard
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
just use
=text(a1,"(any format)")
the format dd/mm'yyy ahould within quotation marks.
venkat
 

Forum statistics

Threads
1,136,928
Messages
5,678,623
Members
419,776
Latest member
mikelowski

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
Top