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.

Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. Olufunso Adewumi 680 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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.