[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

slicer magic

Posted on 2014-01-23
7
Medium Priority
?
1,374 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
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…

650 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