Dear members,
I have a woorkbook with 6 pivot tables, each pivot table has its own data source.
I want a macro that creates a new dynamic range while updating pivot tables. Otherwise, a macro that checks the last column and last row with data to create a dynamic range by using cell A1 from the data source worksheet (the number of rows changes with each update of data source)
[/CODE]
what should I add to this code ?
can someone please assist regarding this issue
Many thanks
Best regards,
I have a woorkbook with 6 pivot tables, each pivot table has its own data source.
I want a macro that creates a new dynamic range while updating pivot tables. Otherwise, a macro that checks the last column and last row with data to create a dynamic range by using cell A1 from the data source worksheet (the number of rows changes with each update of data source)
VBA Code:
[CODE=vba]Sub refreshallpivottables()
Dim ws As Worksheet
Dim pt As PivotTable
For Each ws In ThisWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt
Next ws
End Sub
what should I add to this code ?
can someone please assist regarding this issue
Many thanks
Best regards,