Macro Automation

B

bmorgan8h

Is is possible for a cell result to trigger the operation of a macro on the
spreadsheet?
 
M

Mike H

Hi,

I'm afraid the answer is maybe. For example if A1 has a formula in it and
the values changes because another cell changed then you can't fire a macro
based on the result of A1.

you can't say
=if(a1=6,MyMacro,"")

What you can do is look at the cell that cause A1 to change (assuming that
too wasn't a formual) and call a macro in the worksheet_change event.

Example

In A1
=B1
Someone change B1 you can then call a macro as a result of b1 changing

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox Range("A1").Value
End Sub


Mike
 
P

Per Jessen

You can use an event macro which will fire when the sheet is recalculated.

Private Sub Worksheet_Calculate()
If Range("A1").Value = "Go" Then
Call YourMacro
End If
End Sub

The above macro has to go into the code sheet for the desired sheet.

Hopes this helps.
 
B

bmorgan8h

I don't quite understand your Private Sub. Can you be a little more
descriptive for a novice.
thanks
 
Top