Starting macro

  • Thread starter Thread starter Davidm
  • Start date Start date
D

Davidm

I am trying to start a macro on the condition of a cell. For example when
A7>=10 it starts the macro and runs it through once.
Regards Dave
 
Sub Macro1()
If Range("A7").Value >= 10 Then
Call Macro2
End If
End Sub

this Macro1 starts Macro2 based on your condition

pls click YES if it helped
 
You could use event code to run the macro.

How is the number in A7 derived? Manually or by formula?

Example code for a formula-derived result in A7. Edit to Worksheet_Change
if manually input.

Private Sub Worksheet_Calculate()
'Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("A7")
If .Value >= 10 Then
Call macroname
End If
End With
stoppit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 
Back
Top