Hello there,
Im having trouble with a macro... Im trying to run a macro from a Worksheet_Calculate
Although the macro is activating it seems to get caught in a loop and comes up with a Runtime Error 28 Out of stack space message. I've tried a few ways around it but nothing seems to work. The Macro does move around to different sheets which seems to cause the problem. The code is below, and help greatly appreciated!
Private Sub Worksheet_Calculate()
Dim FormulaRange As Range
Set FormulaRange = Me.Range("B9")
For Each formulacell In FormulaRange.Cells
With formulacell
If .Value > 0.99 Then
'Player A
If Range("J15") = 3 And Range("B3") = 0 Or Range("B2") = 0 And Range("J15") = 3 Then
'Back / Lay value flat & ready to cancel
Cancel_PlayerA
Else
If Range("B3") = 0 And Range("J13") = 0 Then
'Lay value flat & not laid
LAY_Player_A
Else
If Range("B2") = 0 And Range("J12") = 0 Then
'Back value flat & not backed
BACK_Player_A
Else
If Range("B2") = 0 Or Range("B3") = 0 And Range("J14") = 0 Then
'Back / Lay value flat not yet ready to cancel
Range("J14") = 1
Else
End If
End If
End If
End If
'Player B
If Range("B4") = 0 And Range("K15") = 3 Or Range("B5") = 0 And Range("K15") = 3 Then
'Back / Lay value flat & ready to cancel
Cancel_PlayerB
Else
If Range("B5") = 0 And Range("K13") = 0 Then
'Lay value flat & not laid
LAY_Player_B
Else
If Range("B4") = 0 And Range("K12") = 0 Then
'Back value flat & not backed
BACK_Player_B
Else
If Range("B4") = 0 Or Range("B5") = 0 And Range("K14") = 0 Then
'Back / Lay value flat not yet ready to cancel
Range("K14") = 1
Else
End If
End If
End If
End If
End If
End With
Next formulacell
End Sub
Bookmarks