Disable an event

pdqsasse
03-23-2003, 03:46 PM
Can anyone tell me how to temporarily disable an event. I want a sheets 'change' even to clear all the data on that sheet if certain criteria are not meet, however doing so starts the sheets change event again. I need to prevent this from happening. Thank you.
Or if you can tell me an easier way for to cause something to happen only after a user has pasted information into cell A1, that would be great. Here is what I have


Private Sub Worksheet_Change(ByVal Target As Range)
If Range("a1").Value <> Empty Then
MsgBox "Thank you"
Worksheets("Hours").Visible = True
Else
MsgBox "you must paste to cell A1 only, thank you"
Cells.Value = ""
Range("a1").Activate
End If


End Sub

Insomniac
03-24-2003, 02:02 PM
Application.EnableEvents = False

dont forget to set it back to true at the end of your code.

pdqsasse
03-24-2003, 05:29 PM
Thank you. That was easy. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum