Turning off a Worksheet_Change Event...

MDodd73
04-01-2003, 10:25 AM
Is it possible to use a checkbox to turn on/off a Worksheet_Change Event? ie, when it's checked, the Worksheet_Change sub is active, and unchecked, inactive?

If this isn't possible, is there anyway to do this? (I just figure a checkbox is a simpler method than using the apostrophy to deactivate the procedure...)

Thanks...

--Dodd

Wamphyri
04-01-2003, 10:31 AM
You can't turn off the event, but you can prevent the code in that event from running. Just use an if statement around your code.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Sheet1.CheckBox1.Value = True Then
'your code
End If
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum