Hi,
I am working on one Code which should update my pivot data in pivot and then also change month from previous one to current one...but I am getting one error not sure why?
Can anyone look into this please....
I am working on one Code which should update my pivot data in pivot and then also change month from previous one to current one...but I am getting one error not sure why?
Can anyone look into this please....
Code:
Sub vbax_60020_PT_update()
Dim NewSource As String
Dim FilterMonth
With Worksheets("Raw")
NewSource = .Name & "!" & .Cells(1).CurrentRegion.Address(ReferenceStyle:=xlR1C1)
FilterMonth = Application.Max(.Columns(1))
End With
With Worksheets("Pivot").PivotTables("PivotTable1")
.ChangePivotCache ThisWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=NewSource)
.RefreshTable
.PivotFields("Month").CurrentPage = FilterMonth
End With
End Sub