Database refresh crash

K

Kate Smith

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
 

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

Top