title: Change the pivot Table filter using VBA
body: <p>I have a pivot table which contains the "CoB Date" field as shown.<br>
  I am trying to create a macro which automatically changes the date as per the user input.<br>
  I've written the following macro code. But it shows the error: <br></p>
  
  <p><em>Unable to get PivotFields property of the PivotTable class</em></p>
  
  <p>Can any one help me with this?<br>
  Note: Assume that Date Format is not an issue</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>Sub My_macro()
      Dim num as String
      num = InputBox(Prompt:="Date", Title:="ENTER DATE")
      Sheets("Sheet1").PivotTables("PivotTable1") _
          .PivotFields("CoB Date").CurrentPage = num
  End Sub
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/SwfLx.jpg" alt="enter image description here"></p>