nniedzielski
Well-known Member
- Joined
- Jan 8, 2016
- Messages
- 590
- Office Version
- 2019
- Platform
- Windows
Hello-
I have a workbook that I created to format and rearrange some data, it then creates a Pivot Table. That works great.
I use this code in another button to reset the workbook:
However, I found that the users will click on the grand totals inside the pivot table to look at tabled data, when that happens, the sheet will be named something like Sheet7, Sheet8, etc. How can I add to my code to grab any Worksheet that has the name Sheet in it to have it deleted when the workbook is reset?
thank you,
I have a workbook that I created to format and rearrange some data, it then creates a Pivot Table. That works great.
I use this code in another button to reset the workbook:
VBA Code:
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Sheets("Load Data").Delete
Sheets("Pivot").Delete
Sheets.Add(After:=Sheets("Index")).Name = "Load Data"
Sheets.Add(After:=Sheets("Load Data")).Name = "Pivot"
Sheets("Index").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
However, I found that the users will click on the grand totals inside the pivot table to look at tabled data, when that happens, the sheet will be named something like Sheet7, Sheet8, etc. How can I add to my code to grab any Worksheet that has the name Sheet in it to have it deleted when the workbook is reset?
thank you,