?
Solved

slicer magic

Posted on 2014-01-23
7
Medium Priority
?
1,345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 18

Assisted Solution

by:Steven Harris
Steven Harris earned 2000 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

801 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