rockyseenu
New Member
- Joined
- Sep 19, 2011
- Messages
- 1
Dear Friends,
This is my first post, so kindly excuse if i am not following the standard procedures correctly - My problem is with the refresh of a pivot table in my worksheet - i am using the below code to refresh all pivot tables in the workbook. But this is returning an error "This command needs at least two rows of source data.......". I am not able to refresh the data in the pivot tables manually either. Getting the same error. Appreciate any support with this. Many Thanks.
Code:
Dim pt As PivotTable
Dim wkb As Workbook
Dim wks As Worksheet
Set wkb = ActiveWorkbook
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
For Each wks In wkb.Worksheets
For Each pt In wks.PivotTables
Application.StatusBar = "Refreshing " & pt.Name & " From " & wks.Name
pt.RefreshTable
Next pt
Next wks
Application.Calculation = xlCalculationAutomatic
Application.StatusBar = False
This is my first post, so kindly excuse if i am not following the standard procedures correctly - My problem is with the refresh of a pivot table in my worksheet - i am using the below code to refresh all pivot tables in the workbook. But this is returning an error "This command needs at least two rows of source data.......". I am not able to refresh the data in the pivot tables manually either. Getting the same error. Appreciate any support with this. Many Thanks.
Code:
Dim pt As PivotTable
Dim wkb As Workbook
Dim wks As Worksheet
Set wkb = ActiveWorkbook
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
For Each wks In wkb.Worksheets
For Each pt In wks.PivotTables
Application.StatusBar = "Refreshing " & pt.Name & " From " & wks.Name
pt.RefreshTable
Next pt
Next wks
Application.Calculation = xlCalculationAutomatic
Application.StatusBar = False