This behavior can occur when you use the
Redo Delete command on the
Edit menu in the manner shown in the following example:
- Start Excel, and then press ALT+F11 to start the Microsoft Visual Basic Editor.
- In the Project-VBAProject window, double-click Sheet1, and then type the following macro in the module sheet:
Private Sub Worksheet_Change (ByVal Target As Excel.Range)
MsgBox "Worksheet_Change event"
End Sub
This macro runs when any change is made to sheet 1 of the workbook.
- In the Project-VBAProject window, double-click ThisWorkbook, and then type the following code in the code sheet:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
MsgBox "Workbook_SheetChange event"
End Sub
This macro runs when any change is made to the workbook.
- Press ALT+F11 to return to Excel, and then type test in cell A1.
Note the appearance of the two message boxes from the change event macros that you just created. - Select cell A1, and then on the Edit menu, click Delete.
- In the Delete dialog box, accept the default (or click any option), and then click OK.
Note that both message boxes appear. - On the Edit menu, click Undo Delete.
Note that the both message boxes appear.