J
Jeff Wright
Greetings!
I've spent hours trying to figure out why the following subroutine
unexpectedly jumps to another subroutine [Sub ToggleButton1_Click()] when it
hits the line "Worksheets("Mirrors").ToggleButton1.Value = False" in the
macro below. What would automatically trigger this macro to jump into
another macro - especially when I have the line "Application.EnableEvents =
False" at the beginning of this macro?
Also, if I rem out the line "Worksheets("Mirrors").ToggleButton1.Value =
False", the macro will instead jump to a user function when it hits the line
Worksheets("Mirrors").Range("D8") = "Clear". (I do have a sheet module
subroutine in this workbook with the line Private Sub Worksheet_Change(ByVal
Target As Range), where range "D8" is the target.)
What am I doing wrong? Your help is much appreciated.
Thanks!
Jeff
Sub MIRROR()
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Worksheets("Mirrors").ToggleButton1.Value = False
Worksheets("Mirrors").Range("D8") = "Clear"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Range("D8").Select
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
I've spent hours trying to figure out why the following subroutine
unexpectedly jumps to another subroutine [Sub ToggleButton1_Click()] when it
hits the line "Worksheets("Mirrors").ToggleButton1.Value = False" in the
macro below. What would automatically trigger this macro to jump into
another macro - especially when I have the line "Application.EnableEvents =
False" at the beginning of this macro?
Also, if I rem out the line "Worksheets("Mirrors").ToggleButton1.Value =
False", the macro will instead jump to a user function when it hits the line
Worksheets("Mirrors").Range("D8") = "Clear". (I do have a sheet module
subroutine in this workbook with the line Private Sub Worksheet_Change(ByVal
Target As Range), where range "D8" is the target.)
What am I doing wrong? Your help is much appreciated.
Thanks!
Jeff
Sub MIRROR()
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Worksheets("Mirrors").ToggleButton1.Value = False
Worksheets("Mirrors").Range("D8") = "Clear"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Range("D8").Select
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub