Hey guys,
I have a spreadsheet that runs extremely slow when I try to run code recorded by a macro. I suspect it will run faster if the macro used more efficient code. It seems like an easy fix, but I have almost no experience with the VBA language. I get run time errors when I try to make edits like removing/combining unneeded lines like .Select methods.
Any help? Here's the code:
Thanks in advancePrivate Sub CommandButton1_Click() Application.Goto Reference:="R2C1" Sheets("DataTable").Select Application.Goto Reference:="R2C1" Selection.QueryTable.Refresh BackgroundQuery:=False Sheets("Direct PivotRpts").Select Application.Goto Reference:="R6C1" ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh Sheets("Rep PivotRpts").Select Application.Goto Reference:="R8C1" ActiveSheet.PivotTables("PivotTable4").PivotCache.Refresh Application.Goto Reference:="R36C1" ActiveSheet.PivotTables("PivotTable5").PivotCache.Refresh ActiveWindow.SmallScroll Down:=35 Application.Goto Reference:="R67C1" ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh Sheets("Rep INFO!").Select Application.Goto Reference:="R25C1" End Sub Private Sub CommandButton2_Click() Application.Goto Reference:="R40C5" Sheets("Direct PivotRpts").Select Application.Goto Reference:="R6C1" ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh Sheets("Rep INFO!").Select Application.Goto Reference:="R40C7" End Sub
Bookmarks