- The change that you make assigns the VBA Date format or the Variant Date format to the cell.
- You make the programmatic change by using a Visual Basic for Applications macro or by using an external Automation client.
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.
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.
Dim d As Date
d = ActiveSheet.Range("A1").Value
ActiveSheet.Range("B1").Value2 = d
Article ID: 875526 - Last Review: Mar 29, 2017 - Revision: 4