D
Drew
I am trying to click on a command button in a worksheet that will refresh
pivot tables and ODBC connections throughout my workbook. The code seems to
work well to refresh the pivot tables, but once it hits the ODBC data it
errors out.
Can someone help me with my code?
Sheets("Sheet1").PivotTables("PivotTable1").RefreshTable
Sheets("Sheet2").PivotTables("PivotTable1").RefreshTable
Sheets("Sheet3").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Sheet4").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
pivot tables and ODBC connections throughout my workbook. The code seems to
work well to refresh the pivot tables, but once it hits the ODBC data it
errors out.
Can someone help me with my code?
Sheets("Sheet1").PivotTables("PivotTable1").RefreshTable
Sheets("Sheet2").PivotTables("PivotTable1").RefreshTable
Sheets("Sheet3").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Sheet4").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False