View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lori Lori is offline
external usenet poster
 
Posts: 272
Default 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!