1

I am trying to automate a particular Pivot table filtering using VBA. I am not sure how to add "Report Filter" (please see attached screen shot) using VBA.

To automate the process, I got the code for adding rows , columns and values , but can't seem to find the code for report filter.

Can you please help me out with the code for this.

Filter

Report Filter

3
  • 1
    What code have you tried and what was the problem with it? Commented Sep 15, 2017 at 14:30
  • 2
    best way to check how to do anything - record a macro and you will see Commented Sep 15, 2017 at 19:13
  • @braX I need a code for pivot table to add Report Filter. Eg. We can add pivot tables manually and apply/insert 4 basic properties namely filters, Columns , Rows and summation value(See attached image). To automate the process, I got the code for adding rows , columns and summation values , but can't seem to find the code for report filter. Can please help with that? Commented Sep 17, 2017 at 20:07

1 Answer 1

1

Thanks @avb for the suggestion . Recording the macro helped. The code for adding pivot report filter is this.

    Sub pivotReportFilter(ptUse As PivotTable, fName As String)

     With ptUse.PivotFields(fName)
      .Orientation = xlPageField
      .Position = 1
     End With

   End Sub
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.