Filtering multiple pivottables from a cell value

Luke1690

Board Regular
Joined
Jul 26, 2022
Messages
121
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Guys,

can someone tell me why this command doesn't work, the code gets all the way to .Clearallfilters and clears them all. But it wont recognise .currentpage = a

the value is a date in the format 19/09/2024 (not sure if that's got something to do with it?)


Sub pivotall()
Dim a As String
Dim pt As PivotTable
ThisWorkbook.Worksheets("data calculations").Activate

a = Worksheets("data calculations").Cells(1, 2).Value
Sheets("Data Calculations").Select
For Each pt In ActiveSheet.PivotTables
With pt.PivotFields("date")
.ClearAllFilters
.CurrentPage = a
End With
Next
End Sub

thanks as always.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi Guys,

can someone tell me why this command doesn't work, the code gets all the way to .Clearallfilters and clears them all. But it wont recognise .currentpage = a

the value is a date in the format 19/09/2024 (not sure if that's got something to do with it?)


Sub pivotall()
Dim a As String
Dim pt As PivotTable
ThisWorkbook.Worksheets("data calculations").Activate

a = Worksheets("data calculations").Cells(1, 2).Value
Sheets("Data Calculations").Select
For Each pt In ActiveSheet.PivotTables
With pt.PivotFields("date")
.ClearAllFilters
.CurrentPage = a
End With
Next
End Sub

thanks as always.
sorted thanks
 
Upvote 0
Please do not mark a post as the solution, unless you actually post the solution.
If you want to post what you did to fix it, then you can mark that post as the solution.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

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