Pivot table - remove worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
'=========================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top