The simply command in the Sheet1 module:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Range("J5:M5").ClearContents
End Sub
causes Excel to crash.
The simply command in the Sheet1 module:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Range("J5:M5").ClearContents
End Sub
causes Excel to crash.
You are going into a infinite loop. When you clear your cell, you reactivate the macro, and then when you clear your cell, you reactivate the macro, and then when you clear your cell.....
Disable events before you make your change and the re-enable them with
Application.EnableEvents = False
Range("J5:M5").ClearContents
Application.EnableEvents = True
You may also want to consider applying this to a specific range. Do you really want any change on this sheet to trigger your macro? Or are you looking for a change in a specific region? If so, specify the region, and run the macro when that region Intersects
(overlaps) with the changed cell.