Monday, April 12, 2010

Prevent endless loops within events:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo ResetEvents
Application.EnableEvents = False
'Your code here.
Application.EnableEvents = True

Exit Sub
ResetEvents:
Application.EnableEvents = True
End Sub

No comments: