The information in this article applies to:
SYMPTOMS
In the versions of Microsoft Excel listed at the beginning of this article,
if you enter a date in a cell while you are recording a Visual Basic for
Applications macro, the macro may incorrectly enter the date when you run
the macro.
CAUSE
This problem occurs because, when you enter a date while recording a macro,
the recorded code contains a two-digit year number instead of a four-digit
year number. For example, the recorded code is similar to the following:
When you execute this line of code, Excel inserts the date into the cell as the two-digit year number, 20. As a result, the date falls between 1920 and 2019. This behavior occurs regardless of the date you actually entered in the cell while recording the macro. For more information about how Excel works with two-digit year numbers, please see the following article in the Microsoft Knowledge Base: Q164406 XL: How Microsoft Excel Works with Two-Digit Year Numbers WORKAROUNDMicrosoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft Support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp To work around this problem, modify the recorded code. For example, if the line of code is the following
change it to the following:
After you do this, the code inserts the correct date into the active cell when you run the macro. STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. MORE INFORMATIONFor more information about how Microsoft products are affected by year 2000 (Y2K) issues, please see the following Microsoft World Wide Web site: http://www.microsoft.com/year2000/ Additional query words: XL5 XL7 y2k year2000 1919 1920 1929 1930 2019 2020 2029 2030
Keywords : kb2000 xlvbainfo xlformula |
Last Reviewed: November 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |