Looping through all Slicers in Workbook

Richynero

Board Regular
Joined
Jan 16, 2012
Messages
150
Hello all,

I have a workbook with about 100 pivot tables (no joke) and I need to change all the slicers associated with them to 'Don't move or size with cells'.

When I record a macro to change 2 slicers on 1 sheet attached to 1 pivot table I get this:

Code:
  ActiveSheet.Shapes.Range(Array("Entity 4")).Select
    Selection.Placement = xlFreeFloating


    ActiveSheet.Shapes.Range(Array("Internal/External 4")).Select
    Selection.Placement = xlFreeFloating

But I want to change this to loop through all sheets and if there is a pivot table, then change all slicers (ranging from 1 to 3 slicers with any given pivot table, 1 pivot table per worksheet) to 'Don't move or size with cells'.

Any ideas?

Thanking you for your help in advance

Richard
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hello there, me again!

I managed to work it out..

Code:
Sub LoopShapes()


Dim shp As Shape


    For Each wsh In Application.Worksheets
    
    wsh.Activate
    
        For Each shp In ActiveSheet.shapes
        
        shp.Placement = xlFreeFloating
        
        Next shp
    
    Next wsh


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,108
Members
449,205
Latest member
ralemanygarcia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top