View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Macro in Excel not updating spreadsheet

If the workbook opens on a sheet that does not have a pivot table, then the
ActiveSheet.PivotTables("PivotTable1").RefreshTabl e will fail. If the table
is on Sheet 1 of all workbooks, then you can simply put Sheets(1).Activate in
the Macro1 code to ensure it is the active sheet.


"Cameron" wrote:

I have an embedded macro that runs when a certain spreadsheet is called from
inside access. For the most part the sheet works on certain machines but will
not run on all computers. I am kind of baffled why the spreadsheet will not
open up and refresh.

The code I have under the spreadsheet is:

Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window)
Macro1
Application.WindowState = xlMaximized
Wn.WindowState = xlMaximized
End Sub

Module1
Sub Macro1()
ActiveSheet.PivotTables("PivotTable1").RefreshTabl e
End Sub