Reputation: 275
He all I need help writing an If statement that will run a macro every time the value in cell D8 is over one. No idea where to start
Upvotes: 0
Views: 1971
Reputation: 149325
It is a simple if statement.
If Range("D8").Value > 1 Then
'~~> Your code here
End If
You can put that in the Worksheet_Change
event. I would also recommend reading this link which talks about Worksheet_Change
If the value in Range("D8")
is changing because of a formula then you might have to use the _Calculate
event. See this link for an example.
Upvotes: 0
Reputation: 53663
Here you go...
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D1")) Is Nothing Then Exit Sub
If Not Range("D1").Value > 1 Then Exit Sub
MsgBox "D1 > 0"
End Sub
For more info on the _Change event:
http://msdn.microsoft.com/en-us/library/office/ff839775.aspx
Upvotes: 1