Excel VBA questions and solutions

VBA is automatically re-formatting a date from DD/MM/YYYY to MM/DD/YYYY (USA format), how do I correct this?

When your system is set up to display dates in DD/MM/YYYY format based on your regional settings in Windows. This happens when your macro codes gets a date from a worksheet or the clipboard, and then pastes it elsewhere. And you may find the usual code for formatting cell number formats doesn’t work:

 Selection.NumberFormat = “dd/mm/yyyy” 

Instead use the following version:

 Selection.NumberFormat = “dd/mm/yyyy;@”

 

 

Scroll to Top