VBA & Macro Problems

Turn Off Date Changes in Excel VBA and Preserve Text Entries

Jason MillerJason Miller Nov 18, 2026 868 views

Question details

Prevent Excel from changing date-like entries, including changes caused by worksheet event macros.

Turn Off Date Changes in Excel VBA and Preserve Text Entries
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In Excel, open Developer > Visual Basic, then choose Insert > Module.

2
Add an event-safe macro

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

3
Run the macro

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.

Disable Excel Events During a VBA Cell Update
If events remain disabled: If a macro was interrupted before cleanup, open the VBA editor's Immediate window with View > Immediate Window, enter Application.EnableEvents = True, and press Enter.
Free Microsoft Office alternative

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.

Format spreadsheet cells as text before entering date-like valuesOpen and edit Microsoft Excel XLSX filesWork in a familiar spreadsheet interfaceUse a free, lightweight Office suite
microsoft office alternative - wps office

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.