PivotTables Refresh not work

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
The following is the VBA code which is used to refresh
the PivotTable. But I found that it is always failed to
reflect newly added data (without any error) after the
first refresh.
Have anyone have any idea?
===========================================================
Sub report_refresh()
Dim datarange As Variant

Sheets("report").Select
On Error Resume Next
ActiveSheet.PivotTables("Report1").PivotSelect "",
xlDataAndLabel
datarange = "Data!R1C1:R" & Trim(Str(Worksheets
("Container").Range("max_data").Value)) & "C6"
Sheets("Report").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase,
SourceData:= _
datarange
ActiveSheet.PivotTables("Report1").RefreshTable

Application.CommandBars("PivotTable").Visible = False

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top