How do I update a cell in Excel without firing an Change event?

Da Grizz 20 Reputation points
2024-04-22T23:34:06.97+00:00

I'm trying to backfill a cell that is used to hold a function parameter. The new value may be different from the original, hence the need to update. What I don't want to do is execute the function after the new parameter is set.

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,476 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,508 questions
0 comments No comments
{count} votes

Accepted answer
  1. Olufunso Adewumi 230 Reputation points Microsoft Employee
    2024-04-22T23:49:25.88+00:00

    To update a cell in Excel without triggering a Change event, you can use the Application.EnableEvents property in VBA. Here’s a simple example of how you might use it:

    Sub UpdateCellWithoutChangeEvent()
        Application.EnableEvents = False
        ' Update your cell here
        Range("A1").Value = "New Value"
        Application.EnableEvents = True
    End Sub
    

    This code turns off event triggers, updates the cell, and then turns the event triggers back on. Remember to always set Application.EnableEvents back to True after updating the cell to ensure that other events can continue to be handled normally.

    If you are looking for more advanced handling or specific scenarios, you might want to look into the Excel documentation or forums for more detailed examples and guidance. https://learn.microsoft.com/en-us/office/client-developer/excel/multithreaded-recalculation-in-excel


0 additional answers

Sort by: Most helpful