Turn Off Date Changes in Excel VBA and Preserve Text Entries
Question details
Prevent Excel from changing date-like entries, including changes caused by worksheet event macros.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants to update cells with VBA without triggering event-driven changes to date entries.
- Observed behavior
- Date-like entries may be converted by Excel or changed by a worksheet event macro.
Check whether a Worksheet_Change or other event macro is modifying the cells. If Excel converts an entry to a date even when no event macro runs, use text formatting before entering the value instead.
Disable Excel Events During a VBA Cell Update
Use this method when a worksheet event macro causes the unwanted change.
Application.EnableEvents controls Excel events; it is not a switch for Excel's automatic date conversion. Disabling events affects all open workbooks in the Excel instance until the setting is restored.
In Excel, open Developer > Visual Basic, then choose Insert > Module.
Paste the following code into the module, and replace the example cell update with your own changes: Sub UpdateCellsWithoutEvents() Dim previousEvents As Boolean Dim errorNumber As Long Dim errorDescription As String previousEvents = Application.EnableEvents On Error GoTo CleanUp Application.EnableEvents = False ThisWorkbook.Worksheets("Sheet1").Range("A1").Value = "example" CleanUp: errorNumber = Err.Number errorDescription = Err.Description Application.EnableEvents = previousEvents If errorNumber <> 0 Then MsgBox "Update failed: " & errorDescription, vbExclamation End Sub
Adjust the worksheet name and cell reference, then run UpdateCellsWithoutEvents from Developer > Macros. The cleanup section restores the previous event setting even if the update raises an error.

Format Cells as Text Before Entering Date-Like Values
Use text formatting when Excel itself converts an entry to a date.
Manage Date-Like Entries in WPS Spreadsheets
WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for a smooth move between applications. Use WPS Spreadsheets to work with date-like entries; it does not change Excel's VBA event settings.

Frequently Asked Questions
Is there a VBA switch that turns off Excel's automatic date conversion?
No. Application.EnableEvents disables events, not automatic date conversion. To preserve a date-like value as text, format the target cell as Text before entering it.
What does Application.EnableEvents = False do?
It prevents Excel events, such as Worksheet_Change, from firing while the setting is disabled. Restore the previous setting in a cleanup section because the setting affects the Excel instance, not just one worksheet.
How can I enter a date-like value as text in one cell?
Type an apostrophe before the value, such as '1-2, or select Text in Home > Number Format before entering it.
Can I recover the original entry by changing a converted date cell to Text?
Not reliably. Apply Text formatting first, then re-enter or paste the original value.




