Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
David D
 
Posts: n/a
Default Excel Pivot Table Refresh Question

Hi,
I hope there is someone that can help me with another question
regarding refreshing Pivot tables

I have a spreadsheet with:
-Some worksheets storing lookup information and a data input sheet
-A worksheet containing pivot tables showing results from the input and
lookup sheets
-A report worksheet with a summary of the data using Vlookup on the
Pivot tables worksheet, and performing additional calculations on this
pivot table derived data.

Whenever someone uses the report worksheet the data should be refreshed
from the Pivot tables as this is going to be a shared workbook with
possibly only one or two users occasionally entering data.

Have already tried solutions given to other's peoples questions without
success yet and don't know what I'm doing wrong (am using Excel 2000)

Have tried putting the following in "ThisWorkbook":

Option Explicit
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
ThisWorkbook.RefreshAll
End Sub

Am an Excel VBA newbie... Am also using Excel 2000 so wasn't sure if
this was the reason that this does not work.

Many thanks.

Regards,
David

  #2   Report Post  
Conrad Carlberg
 
Posts: n/a
Default

Hi David,

I haven't seen the earlier questions and solutions you refer to, but ...

If I read your description correctly, you want the pivot tables to refresh
when a user selects the report worksheet. Your code should work (and both
SheetActivate and RefreshAll are available in Excel 2000), but your code
will refresh the pivot tables regardless of which sheet the user selects.
Depending on the number of pivot tables and the size of the data source,
that could get annoying, but it will work. I'd associate the RefreshAll
statement with a Worksheet_Activate event handler instead of a
Workbook_SheetActivate event handler.

I don't believe, though, that you can use RefreshAll in a shared workbook,
even if only one user actually has it open. And bear in mind that you can't
get at your VBA code if the workbook is shared. These are just a couple of
reasons that I don't like shared workbooks. It's a hassle in the short run,
but in the long run it works much better to store and edit the data in, say,
an Access database, and point pivot tables at that database. Handled that
way, each user can have a separate workbook and you avoid the sharing issue.
I suppose you could also save the report worksheet and the pivot tables in
separate workbooks, and point the pivot tables at the original workbook.
Either way, you could trigger a refresh using the Worksheet_Activate event.

C^2
Conrad Carlberg

Excel Sales Forecasting for Dummies, Wiley, 2005


"David D" wrote in message
ups.com...
Hi,
I hope there is someone that can help me with another question
regarding refreshing Pivot tables

I have a spreadsheet with:
-Some worksheets storing lookup information and a data input sheet
-A worksheet containing pivot tables showing results from the input and
lookup sheets
-A report worksheet with a summary of the data using Vlookup on the
Pivot tables worksheet, and performing additional calculations on this
pivot table derived data.

Whenever someone uses the report worksheet the data should be refreshed
from the Pivot tables as this is going to be a shared workbook with
possibly only one or two users occasionally entering data.

Have already tried solutions given to other's peoples questions without
success yet and don't know what I'm doing wrong (am using Excel 2000)

Have tried putting the following in "ThisWorkbook":

Option Explicit
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
ThisWorkbook.RefreshAll
End Sub

Am an Excel VBA newbie... Am also using Excel 2000 so wasn't sure if
this was the reason that this does not work.

Many thanks.

Regards,
David



  #3   Report Post  
David D
 
Posts: n/a
Default

Hi Conrad,

Thanks for the advice!

I used the Worksheet_Activate event in the relevant report worksheets
instead of using the Workbook_SheetActivate, as you suggested. That
seems to be a bit more efficient as this means anyone editing the data
sheets doesn't need to be annoyed by the Workbook refreshing needlessly
all the time. I hadn't checked whether they would work as shared
workbooks, and they do indeed result in error codes when I try to share
them using RefreshAll in the code.

The more I look into this I realise it would be much easier to use
Access as a backend db and just use Excel for reporting only.

Am on a bit of a learning curve with Excel and Access! Thanks for the
help again.

Regards,
David

Brent Primary Care Trust,
NHS. UK

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
Excel Pivot Table Question Tom Excel Discussion (Misc queries) 0 August 2nd 05 06:31 PM
Row limitations on Pivot Table in Excel? Kristina Excel Discussion (Misc queries) 1 July 29th 05 08:22 PM
Printing a Pivot Table from code - Excel 2003 Newbie Excel Discussion (Misc queries) 4 January 5th 05 04:10 PM
pivot table question, sum fields? Todd L. Excel Worksheet Functions 2 November 30th 04 05:07 AM
Pivot table : Excel cannot complete this task with available resou Julie Excel Worksheet Functions 0 November 5th 04 04:09 AM


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

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

About Us

"It's about Microsoft Excel"