Solved

slicer magic

Posted on 2014-01-23
7
1,228 Views
Last Modified: 2014-01-23
Is there a VBA to multi select slicers?
Like there is a slicer group called [Rep]. I can now go and hit ctrl + the slicer values to select multiple values within the slicer group. Can the same be done with VBA – multi select slicers withn a slicer group?
slicerMagic.xlsm
0
Comment
Question by:Rayne
  • 4
  • 3
7 Comments
 
LVL 18

Assisted Solution

by:Steven Harris
Steven Harris earned 500 total points
ID: 39803749
If you are wanting to pre-define selected items, you can use:

With ActiveWorkbook.SlicerCaches("Slicer_Rep")
        .SlicerItems("Andrews").Selected = True
        .SlicerItems("Gill").Selected = False
        .SlicerItems("Howard").Selected = False
        .SlicerItems("Jardine").Selected = True
        .SlicerItems("Jones").Selected = False
        .SlicerItems("Kivell").Selected = False
        .SlicerItems("Morgan").Selected = True
        .SlicerItems("Parent").Selected = True
        .SlicerItems("Smith").Selected = False
        .SlicerItems("Sorvino").Selected = True
        .SlicerItems("Thompson").Selected = False
End With

Open in new window

0
 

Author Comment

by:Rayne
ID: 39803877
thank you ThinkSpaceSolutions,
I was thinking of multi-selecting all the values like looping through the slicers in vba ...is that possible?

Thank you
0
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39803905
...multi-selecting all the values like looping through the slicer

Can you explain that a bit further?

Are you wanting to loop through each item in the slicer and enable it?  This would be the same as setting each item to 'True' at one time unless you introduce some other functions that need to happen as well.

Are you wanting to iterate through each item (appending it to the last one) in order to make a visual 'demo'?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Rayne
ID: 39803944
Well yes, I need to somehow loop thorugh each slicer option so that the slicer cache is updated  - as that stores the selection value in the page footer. So when I open the workbook, something needs to happen so that the slicer cache is updated with those values so when I print I see the footer already refreshed
0
 
LVL 18

Accepted Solution

by:
Steven Harris earned 500 total points
ID: 39804071
I think I know what you are after now:

ActiveWorkbook.SlicerCaches("Slicer_Rep").ClearAllFilters
ActiveWorkbook.SlicerCaches("Slicer_Rep").PivotTables(1).PivotCache.Refresh

Open in new window


You will want to add this to a Workbook Open event.
0
 

Author Comment

by:Rayne
ID: 39804335
thanks Sire
0
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39804548
Not a problem!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Outlook Free & Paid Tools
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now