I have a pivot table which contains the "CoB Date" field as shown.  

I am trying to create a macro which automatically changes the date as per the user input.  

I've written the following macro code. But it shows the error:   

*Unable to get PivotFields property of the PivotTable class*

Can any one help me with this?  

Note: Assume that Date Format is not an issue

**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

```

![enter image description here](https://i.stack.imgur.com/SwfLx.jpg)