Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Aastha
 
Posts: n/a
Default Pivot Tables -- Auto Refresh

I looked at the submissions in the group, and the VB script solution
didn't work for me, hence this question.

Have a workbook in which the data is obtained from a database. This is
stored in one worksheet called "All Data". Another worksheet has a
pivot table which depends on the "All Data" worksheet. My problem. The
data in the "All Data" refreshes automatically each time I open the
workbook. However, for the refresh to work on the pivot table I have to
manually click the "Refresh all data" button. Is there any way to get
around that??? Please help.

Thanks.

Aastha

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Wright
 
Posts: n/a
Default Pivot Tables -- Auto Refresh

Right click on the table, choose Table options and tick 'Refresh on open'

If for any reason that didn't work then you could use a piece of code such
as the following from Debra Dalgleish combined with the Workbook_Open event,
but you shouldn't need to.

Private Sub Workbook_Open()
'Debra Dalgleish
'gets rid of unused items in PivotTable
' based on MSKB (Q202232)
Dim ws As Worksheet
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim i As Integer

On Error Resume Next
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.RefreshTable
For Each pf In pt.PivotFields
For Each pi In pf.PivotItems
If pi.RecordCount = 0 And _
Not pi.IsCalculated Then
pi.Delete
End If
Next
Next
Next
Next
End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"Aastha" wrote in message
oups.com...
I looked at the submissions in the group, and the VB script solution
didn't work for me, hence this question.

Have a workbook in which the data is obtained from a database. This is
stored in one worksheet called "All Data". Another worksheet has a
pivot table which depends on the "All Data" worksheet. My problem. The
data in the "All Data" refreshes automatically each time I open the
workbook. However, for the refresh to work on the pivot table I have to
manually click the "Refresh all data" button. Is there any way to get
around that??? Please help.

Thanks.

Aastha



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sheet protection code conflicts with Pivot Table "auto refresh" KG Excel Discussion (Misc queries) 6 December 21st 05 11:16 PM
Ho to Delete "Ghost" Pivot Tables needyourhelp Excel Discussion (Misc queries) 3 November 17th 05 10:10 PM
Auto refresh pivot table on Save CindyM Excel Discussion (Misc queries) 2 October 14th 05 08:28 AM
Excel Pivot tables refresh Dkso Excel Worksheet Functions 3 July 3rd 05 04:55 PM
refresh pivot tables through a macro dolph Excel Worksheet Functions 1 January 12th 05 03:16 AM


All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"