Default excel date format for table gets changed after saving workbook in VBA macro

OliverP

New Member
Joined
Feb 24, 2016
Messages
5
Hi there all,

I've got a really strange problem when saving workbooks from an excel macro. My macro is running from one workbook and opening several other workbooks, refreshing data connections in them, saving them and closing them. However if I then open one of the workbooks that has been saved by the macro and type a new date entry in a table (that has nothing to do with the data connections that were refreshed), it is formatted with a "custom" date format of m/d/yyyy, rather than the default date format used for the rest of the table (dd/mm/yyyy in my case).

Note that none of the cells containing existing dates are changed, and if you enter a date outside the table range it is formatted with the default date format.

Any ideas? We can work around by reformatting the cell, or the whole column, back to the default date format, but this is a pain and I would like to know why this is happening. (If I do the exact same operation manually, ie open workbook, refresh all data connections, save and close, then the problem doesn't arise.

Thanks!
Oliver.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,777
Messages
5,833,643
Members
430,221
Latest member
jmmccormick

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