Article ID: 875526 - View products that this article applies to.
When you make a programmatic change to the value in a cell in a Microsoft Excel worksheet, the millisecond value that you specify is rounded to the nearest second. This issue occurs when the following conditions are true:
This issue occurs because Excel internally formats date strings according to the date and time format that is specified on the Regional Options tab of the Regional and Language Options item in Control Panel. This value is rounded to the nearest second. Excel assigns this value to the cell and then recalculates the value to produce a new date value for the cell.
Use one of the following methods to work around this issue.
Method 1You can convert the date value into a string format that contains a fraction of a second. This string value can be assigned to and calculated as a date format that retains the milliseconds.
Method 2You can use the Value2 property of the Range object to retain the milliseconds. For example, you can use the following VBA code.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/182812/ )Description of the Value2 property for the Range object
Article ID: 875526 - Last Review: February 13, 2007 - Revision: 3.1