Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Refreshing external data on individual sheets in a specific sequen

Hi All,

I have a workbook consisting of 10 worksheets. First three worksheets
contains Pivot Table, which gets the data from 4th, 5th and 6th worksheets.
4th, 5th and 6th worksheets gets the data (using a web query) from an
external CSV file. I want to have a "Refresh Data" on the fist sheet, which
is when clicked, refreshes the external data and the pivot tables in the
following sequence :-
Refresh the data on 4th Sheet.
Refresh the data on 5th Sheet.
Refresh the data on 6th Sheet.
Refresh the Pivot Tables on 1st sheet.
Refresh the Pivot Tables on 2nd sheet.
Refresh the Pivot Tables on 3rd sheet.

I used "ThisWorkbook.RefreshAll", but it refreshes the data in one go, not
in the required sequence. I also tried "Sheets(index).Calculate" for
different sheets, but it does not refreshes the external data.

Any help in writing the macro/subroutine to achieve this functionality
would be highly appreciated.

Thanks,
Nayan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Refreshing external data on individual sheets in a specific sequen

Nayan" wrote in message
...
Hi All,

I have a workbook consisting of 10 worksheets. First three worksheets
contains Pivot Table, which gets the data from 4th, 5th and 6th
worksheets.
4th, 5th and 6th worksheets gets the data (using a web query) from an
external CSV file. I want to have a "Refresh Data" on the fist sheet,
which
is when clicked, refreshes the external data and the pivot tables in the
following sequence :-
Refresh the data on 4th Sheet.
Refresh the data on 5th Sheet.
Refresh the data on 6th Sheet.
Refresh the Pivot Tables on 1st sheet.
Refresh the Pivot Tables on 2nd sheet.
Refresh the Pivot Tables on 3rd sheet.

I used "ThisWorkbook.RefreshAll", but it refreshes the data in one go, not
in the required sequence. I also tried "Sheets(index).Calculate" for
different sheets, but it does not refreshes the external data.

Any help in writing the macro/subroutine to achieve this functionality
would be highly appreciated.

Thanks,
Nayan


Hi Nayan

I wrote a couple of subs a few years ago when i was experiencing a similiar
problem.

If you call UpdateQueryTablesInWorkBook (to update your web queries) and
then UpdatePivotTablesInWorkBook (to update your pivottables) it ought to
solve your problem.

'Updates all queries in the Workbook
Public Sub UpdateQueryTablesInWorkBook()
Dim s As Worksheet
Dim q As QueryTable

For Each s In ActiveWorkbook.Worksheets
For Each q In s.QueryTables
q.Refresh
Next q
Next s
End Sub

'Updates all Pivottables in the workbook
Public Sub UpdatePivotTablesInWorkBook()
Dim s As Worksheet
Dim p As PivotTable

For Each s In ActiveWorkbook.Worksheets
For Each p In s.PivotTables
With p.PivotCache
.Refresh
End With
Next p
Next s
End Sub

Regards
Marinus Calitz


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
Refreshing External Data eggpap Excel Programming 1 December 17th 07 02:46 AM
Refreshing external data JohnUK Excel Programming 2 October 12th 07 12:56 PM
Refreshing External Data Ranges PJFry Excel Programming 4 September 24th 07 11:44 PM
Refreshing external data JohnUK Excel Programming 5 September 13th 07 12:52 PM
Query to external data not refreshing R Ormerod Excel Discussion (Misc queries) 1 April 1st 05 08:39 PM


All times are GMT +1. The time now is 03:27 AM.

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"