T
Trevor Williams
Hi All
Many moons ago I posted a message regarding triggering an event before the
sheet deactivates... I had 2 responses, one of which was from Peter T as
follows:
Private Sub Worksheet_Deactivate()
If Len(Range("A1")) = 0 Then ' empty cell A1
On Error GoTo errH:
' if necessary disable events
Application.EnableEvents = False
Me.Activate
Application.Goto Range("A1"), True
MsgBox "Complete cell A1"
End If
errH:
Application.EnableEvents = True
End Sub
This works well except all the sheets in my workbook have a
Worksheet_Activate event. The above code does reactivate the sheet if not
filled in correctly, but the code for the target sheet still runs, which then
gives errors.
My question is, can the worksheet_activate code for the target sheet be
switched off if the above code discovers a FALSE value on the original sheet?
I'm not using buttons to navigate the workbook so I can't capture it that way.
I hope thats clear(?)
Thanks in advance
Trevor Williams
Many moons ago I posted a message regarding triggering an event before the
sheet deactivates... I had 2 responses, one of which was from Peter T as
follows:
Private Sub Worksheet_Deactivate()
If Len(Range("A1")) = 0 Then ' empty cell A1
On Error GoTo errH:
' if necessary disable events
Application.EnableEvents = False
Me.Activate
Application.Goto Range("A1"), True
MsgBox "Complete cell A1"
End If
errH:
Application.EnableEvents = True
End Sub
This works well except all the sheets in my workbook have a
Worksheet_Activate event. The above code does reactivate the sheet if not
filled in correctly, but the code for the target sheet still runs, which then
gives errors.
My question is, can the worksheet_activate code for the target sheet be
switched off if the above code discovers a FALSE value on the original sheet?
I'm not using buttons to navigate the workbook so I can't capture it that way.
I hope thats clear(?)
Thanks in advance
Trevor Williams