Microsoft Excel VBA Bug Since Leap Year RRS feed

  • Question

  • My macro was working perfectly until 1st March 2016.

    I am putting a date into a .csv file using:

    Format(date, "dd-mm-yy")

    After this is complete another macro sets a cell in another .xlsm file equal to the date cell set above.

    On 1st March, it set the date equal to the 03rd Jan and on the 2nd March it set the date equal to the 3rd Feb. Also in the .csv the number format of the date is equal to 42430 but in the .xlsm it is equal to 42403.

    Wednesday, March 2, 2016 10:17 AM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Emi Zhang
    TechNet Community Support

    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact

    Thursday, March 3, 2016 3:03 AM
  • Hi Bules,

    What did you mean "putting a date into a .csv file using:Format(date, "dd-mm-yy")"? Would you mind sharing with us the detail steps to reproduce this issue?

    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 10, 2016 8:15 AM
  • Option Explicit Sub Test() Dim r As Range Dim d As Date Set r = Range("B2") d = #1/3/2016# '=42430 r = Format(d, "dd-mm-yy") End Sub

    Best regards George

    Sunday, March 20, 2016 3:55 PM