XL: Date Inserted by Recorded Macro May Be in Wrong CenturyID: Q182766
|
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.
Specifically, the date may be in the wrong century; for example, instead of
1/1/2020, the date appears as 1/1/1920.
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:
ActiveCell.FormulaR1C1 = "1/1/20"
Q164406 XL: How Microsoft Excel Works with Two-Digit Year Numbers
Microsoft 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/refguide/
ActiveCell.FormulaR1C1 = "1/1/20"
ActiveCell.FormulaR1C1 = "1/1/2020" 'January 1, 2020
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
For 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/y2k/
Additional query words: XL5 XL7 y2k year2000 1919 1920 1929 1930 2019 2020 2029 2030
Keywords : kb2000 xlvbainfo xlformula
Version : MACINTOSH:5.0,5.0a; WINDOWS:5.0,5.0c,7.0,7.0a; winnt:5.0
Platform : MACINTOSH WINDOWS winnt
Issue type : kbbug
Last Reviewed: May 19, 1999