Consulting

Results 1 to 4 of 4

Thread: Problem with Deleting Slicers

  1. #1

    Problem with Deleting Slicers

    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!

  2. #2
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,407
    Location
    I moved this thread to the Excel BI forum, where Slicers are more frequently discussed.
    Please take the time to read the Forum FAQ

  3. #3
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    5,386
    Location
    What is "WorksheetName" ?
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,407
    Location
    8 months old and he hasn't been back
    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •