How To Run A Macro When Cell Value Changes In Excel VBA

Sometimes you want to be able to monitor a range of cells in your worksheet for any changes. Using this, you can run a macro when a cell changes to a specific value.

Here I will show how to run a macro when a cell value changes in Excel VBA

This post will also answer the question you may have, “How do I automatically trigger a macro in Excel?” When the cell value changes, we will trigger a macro to run.

In the following example, I am monitoring the range “A1:A4” (blue shading) for changes.

I want the user to be made aware when the value of the cell changes and what the previous value of the cell was. That way I can write code to have excel vba undo the cell change .

Here’s the code

In the “Worksheet_SelectionChange” event, I can get the previous value.
In the “Worksheet_WorksheetChange” event, I can monitor the cell changes.

Watch me do it:

Let me know if you have any questions.

Use this form to send me a message:

I consent to having this website store my submitted information so they can respond to my inquiry. See our privacy policy to learn more how we use data.

Please remember to subscribe to my youtube channel

Been helped? Get these!