PDA

View Full Version : Sleeper: Problem with Deleting Slicers



avalon8186
08-30-2016, 07:31 AM
I have set up a vba tool in an excel document with two exhibits on separate tabs. Each macro pulls data down from a server location and then builds pivot tables, charts, and slicers.

Both macros begin by deleting all the pivot connections, slicers, slicer caches, and pivot tables. The code is working fine as long as you run one exhibit and not the other. However, if you run the second exhibit, and then go back to run the first exhibit again, it does not delete and replace the slicers. I have tried stepping through the code to see why this might be happening, but it's just not working and I'm not getting any error messages. I have tried two methods for deleting the slicers:


WorksheetName.Shapes.Range(Array("Slicer Name")).Delete
For Each SL In WorksheetName.Shapes
If SL.Type = msoSlicer Then SL.Delete
Next SL

The SL dim is defined as a Shape, in this instance.

Again, as long as you run one exhibit and not another, the step to delete and replace the slicer works fine. This error only occurs when you run the second exhibit and then go back to the first.

Has anyone encountered a problem like this? Is there another method for deleting slicers I should try?

Thanks!

SamT
08-30-2016, 07:59 AM
I moved this thread to the Excel BI forum, where Slicers are more frequently discussed.

Paul_Hossler
05-12-2017, 05:17 PM
What is "WorksheetName" ?

SamT
05-12-2017, 06:09 PM
8 months old and he hasn't been back