This works for me.
ActiveWorkbook.RefreshAll
Regards,
Bill Simpson
PMO Emerging Programs
972-952-2573
From:
Baljeet Bilkhu <baljeet_bilkhu@yahoo.ca>
To:
ExcelVBA@yahoogroups.com
Date:
05/19/2011 08:07 PM
Subject:
[ExcelVBA] Refreshing Pivot Tables
Sent by:
ExcelVBA@yahoogroups.com
Hi,
I have an Excel file that is retrieving data from an external database and
from this data, I have some pivot tables that are slicing up this data. I
have a command button that will refresh the data as well as refresh the
pivot tables after the data is refreshed using the following code:
Sub Refresh_Data()
Dim pt As PivotTable
ActiveWorkbook.RefreshAll
Sheets("Pivots").Select
For Each pt In ActiveSheet.PivotTables
pt.RefreshTable
Next pt
Worksheets("Summary").Select
End Sub
The data is refreshing properly, but the pivot tables are not. Any ideas
on how this can be done? I have two pivot tables on the "Pivots"
worksheet that need updating.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar