简体   繁体   中英

worksheet_calculate is stuck in a loop

i'm trying to use a formulated cell "F42" to return a value of 1 everytime conditions are met to trigger an event. when the conditions are met it starts looping. i need to be able to trigger this event up to 3-4 times through out the day. i'm guessing i need to create some sort of stored values. but not sure how to go about it. here's what i have:

Private Sub Worksheet_Calculate()
    On Error GoTo skipallthis
    If Range("F42").Value > 0 Then
       Application.EnableEvents = False
       Call BuyConditions
       Application.EnableEvents = True
    End If
 skipallthis:
 End Sub

Private Sub Worksheet_Calculate() On Error GoTo skipallthis If Range("F42").Value > 0 Then Application.EnableEvents = False Call BuyConditions

   'changing this value will prevent the buy conditions from being met
   Sheet6.Range("L32").Value = 1

   Application.EnableEvents = True
End If

skipallthis: End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM