Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50186

Create macro that sorts pivot like value filters - between

$
0
0
I want filter revenue between two numbers for a large amount of customer.
I can record a macro that looks like this

Sub SegmentD()
'
' SegmentD Macro
' Segment D udvælges
'

'
Range("B25").Select
ActiveSheet.PivotTables("PivotTable2").PivotFields("Kundenummer").PivotFilters. _
Add Type:=xlValueIsBetween, DataField:=ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Sum of Omsætning 2012"), Value1:=0, Value2:= _
2917
Application.Goto Reference:="SegmentD"
End Sub

What I would like to is that Value1 and Value2 refers to two cells representing the two values, instead of beeing fixed numbers.
The cells in this case are in O14 and P14

How do I do that

Viewing all articles
Browse latest Browse all 50186

Trending Articles