• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Slicers and VBA

Kofi Dankwah

New Member
I recorded a macro in Excel 2010 which is below. My intention is to print a series of department reports using the slicer values in a slicer that is connected to 3 pivot tables, it worked for the first time after the recording but it does not refresh when I run it again and the report only gives me "Get Data........", there is no refresh of the slicer. In other words I would like to mimic a user clicking the slicer to print.

Any help will be great =, ===

=======================================

Code:
 ActiveWorkbook.SlicerCaches("Slicer_Dept_and_Segment1").VisibleSlicerItemsList _
        = Array( _
       "[Combined Years Dataset].[Dept and Segment].&[0704403 - 00123000]")
    Sheets(Array("PIVOT_cube", "Detail-Summary", "Detail Sheet 2")).Select
    Sheets("PIVOT_cube").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
    Sheets("PIVOT_cube").Select
    ActiveWorkbook.SlicerCaches("Slicer_Dept_and_Segment1").VisibleSlicerItemsList _
        = Array( _
        "[Combined Years Dataset].[Dept and Segment].&[0704404 - 01450000]")
    Sheets(Array("PIVOT_cube", "Detail-Summary", "Detail Sheet 2")).Select
    Sheets("PIVOT_cube").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
    Sheets("PIVOT_cube").Select
    ActiveWorkbook.SlicerCaches("Slicer_Dept_and_Segment1").VisibleSlicerItemsList _
        = Array( _
        "[Combined Years Dataset].[Dept and Segment].&[0704405 - 00666000]")
    Sheets(Array("PIVOT_cube", "Detail-Summary", "Detail Sheet 2")).Select
    Sheets("PIVOT_cube").Activate

End Sub

Thanks

K

Kofi
 
Back
Top