Results 1 to 2 of 2

Thread: Filtering a Pivot by user input value?
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Nov 2016
    Posts
    603
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Default Filtering a Pivot by user input value?

    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

  2. #2
    Board Regular Worf's Avatar
    Join Date
    Oct 2011
    Location
    Rio, Brazil
    Posts
    3,724
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Filtering a Pivot by user input value?

    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
    Excel 2013 / Windows 8.1 (home)
    Excel 2013 / windows 7 (work)


Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •