View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kate Smith Kate Smith is offline
external usenet poster
 
Posts: 2
Default Database refresh crash

Hello everyone,

Here is my problem. I have a macro that does the following:
1. downloads data from database to excel range
2. resizes excel ranges depending on the size of the database download
3. refreshes pivot tables based on newly resized ranges.

The problem is that when I run all 3 sections as one routine, the
macro keeps crashing and the message I'm getting is this:

Runtime Error '1004':
Microsoft excel cannot refresh a PivotTable until refresh of the
external data range on which the PivotTable is based is comlete.

I've tried to fix the problem by calling database download from one
routine and resize and refresh from another. Calling two separate
routines gave me the same error message. Also tried to pause the
application for 20 seconds after calling the database download to give
it time but that didn't help much either.

Routine runs fine when I execute it line by line by hitting F8.

Any ideas on how to fix it?

Thanks

Kate