View Single Post
 
Old 08-16-2011, 11:10 PM
Catalin.B Catalin.B is offline Windows Vista Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

you can setup cell A1 to decide if the macro should run.
info about events :http://www.cpearson.com/excel/events.htm
but will work only when you change the value in cell A1,
it will not fire when a formula result changes, so this means it will work the same way
How do I run a macro every time a certain cell changes its value?
There is an event called Worksheet_Change which is triggered when a value is entered (it will not fire when a formula result changes). One of the arguments to this event is 'Target' which is a reference to what changed. Since this event will occur whenever a value changes - you can use the target to see if it is the cell you are interested in:
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub Else 'Do whatever you need to do... End If End Sub
Reply With Quote