Pivot table - remove worksheet

G

Greg

When I double click a cell in a pivot table the data shows on a new
worksheet. How can I have this worksheet 'delete' when moving to another
worksheet in the workbook?
Thanks, Greg
 
D

Debra Dalgleish

You could use programming to delete the sheets. If no other sheet names
start with "Sheet", you could use code similar to this in the
ThisWorkbook module:

'====================
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If Left(ws.Name, 5) = "Sheet" Then
If ws.Name <> ActiveSheet.Name Then
Application.DisplayAlerts = False
ws.Delete
Application.DisplayAlerts = True
End If

End If
Next ws
End Sub
'=========================
 
Top