If cell value is changed then call macro

Future_MVP

New Member
Joined
Jan 16, 2009
Messages
5
I would like to call up a macro if a cell value is changed. This should be an easy one I am just having trouble getting the code together. Thanks in advance!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Welcome to the board.

You need an event class macro. They go on the actual sheets, not in a module.

something like

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "hi"

End Sub
 
Upvote 0
Search Excel VBA help for the worksheet change event. And, while looking up the help file, take a look at the Calculate event too.
Thank you, but I need to call a macro if a specific cell value is changed, ie. Range("i4")
 
Upvote 0
Thank you, but I need to call a macro if a specific cell value is changed, ie. Range("i4")

Lo and behold, that can be done too.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("I4").Address Then
MsgBox "Hi"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,608
Messages
6,125,820
Members
449,265
Latest member
TomasTeix

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top