ID: Q190831
The information in this article applies to:
In Microsoft Excel 97 for Windows, if you use the Evaluate method in a Visual Basic for Applications macro to evaluate a statement or formula that contains a date, the method may return either of the following error messages:
Run-time error '13':
Type mismatch
-or-
Error 2015
This problem may occur when the following conditions are true:
-and-
-and-
See the "More Information" section later in this article for a demonstration of this problem.
To prevent this problem from occurring, use any of the following methods:
-or-
-or-
Application.Evaluate("DATE(25,7,5)+1")
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
To reproduce this problem, follow these steps:
1. Start Microsoft Excel 97. On the Tools menu, point to Macro, and click
Visual Basic Editor.
2. On the View menu, click Immediate Window. Or, press CTRL+G.
3. Type the following lines of code in the Immediate window. Press ENTER
after you enter each line of code:
?Application.Evaluate("=""2025/7/5""+1")
?Application.Evaluate("=""7/5/25""+1")
?Application.Evaluate("=""25/7/5""+1")
Note the following:
Sub Test()
MsgBox Application.Evaluate("=""25/7/5""+1")
End Sub
you will receive a run-time error 13 (type mismatch) error message. The
problem occurs because the date uses a two-digit year and is entered using
year/month/day date order.
Additional query words: XL97 year2000
Keywords : kb2000 xlvbainfo xlformat
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: November 2, 1998