Filtering a Pivot by user input value?

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
609
Hi,
I have a pivot table with the left column numbers 1-100
And I want to be able to filter between 2 numbers (from user inputboxs for min and max)

Eg. Numbers 11-20 or 1-80

Unsure how to do this,

Any help appreciated
 

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
3,758
Hi

https://www.wiseowl.co.uk/blog/s2458/inputbox.htm

Code:
Sub Macro21()
Dim pt As PivotTable
Set pt = ActiveSheet.PivotTables("pivot2")
pt.PivotFields("status").PivotFilters.Add2 Type:=xlValueIsBetween, DataField:= _
pt.PivotFields("Sum of amount"), Value1:=CDbl(InputBox("Enter min")), Value2:=CDbl(InputBox("Enter max"))
End Sub
 

Forum statistics

Threads
1,078,275
Messages
5,339,227
Members
399,287
Latest member
Dave2804

Some videos you may like

This Week's Hot Topics

Top