Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The "Worksheet_Change" or "Workbook_SheetChange" event does not occur when you use the Cut command to delete a cell that contains a query table or a PivotTable and then try to paste the cell in Excel


View products that this article applies to.

Symptoms

Consider the following scenario. In a new workbook in Microsoft Office Excel 2007 or in Microsoft Office Excel 2003, you create a query table or a PivotTable that is based on an external data source. You set an event handler for a Worksheet_Change event or for a Workbook_SheetChange event.

You use the Cut command to delete a cell that contains the query table or the PivotTable. Then, you try to paste the cell into another cell in the worksheet. When you do this, the Worksheet_Change or Workbook_SheetChange event does not occur.

Note The Worksheet_Change or Workbook_SheetChange event occurs if you copy a cell that contains the query table or the PivotTable and then paste the cell into another cell. The event also occurs if the PivotTable or the query table is based on internal data.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


More information

Steps to reproduce the problem

  1. Start Excel 2007.
  2. Click the Data tab, and then click a button in the Get External Data group to receive data from the external data source.
  3. Press ALT+F11 to start Microsoft Visual Basic for Applications (VBA).
  4. In the Project - VBAProject window, double-click ThisWorkbook.
  5. Copy and then paste the following code into the VBA window.
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
     Stop
    End Sub
    
  6. Close the VBA window.
  7. Use the Cut command to delete the cell in the worksheet that contains the PivotTable, and then paste the cell into another cell.

    Notice that nothing happens.
  8. Copy the cell in the worksheet that contains the PivotTable, and then paste the cell into another cell.

    Notice that the VBA window appears and that the Stop line is highlighted.

↑ Back to the top


Keywords: KB937619, kbtshoot, kbexpertiseinter, kbbug

↑ Back to the top

Article Info
Article ID : 937619
Revision : 1
Created on : 5/30/2007
Published on : 5/30/2007
Exists online : False
Views : 248