ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Mac Excel for 2004 macro date problem (https://www.excelbanter.com/excel-programming/349433-mac-excel-2004-macro-date-problem.html)

Lori

Mac Excel for 2004 macro date problem
 
I am running the following portion of a macro that should return the date for
the end of the previous month:

dt = Format(EoMonth(Date, -1), "mmmm d, yyyy")

This works correctly when I first open the workbook and run the macro for
the first time. However, if I keep the workbook open and run the macro
again, it will return the date that's four years and one day too early. This
appears to be a problem with the 1904 Mac date, but I have unchecked the 1904
date system option in the excel preferences for this workbook. Can I add a
line of code to set the date for the application to not use 1904, so it runs
consistently?
Thanks!

Leith Ross[_458_]

Mac Excel for 2004 macro date problem
 

Hello Lori

Add this line to your to your macro code..

ActiveWorkbook.Date1904 = Fals

Sincerely
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=49776



All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com