This one's a good challenge - slow down a macro!

richardff

New Member
Joined
Apr 3, 2002
Messages
8
Oh where do I start with this!

I have a macro whose sole purpose is to open another workbook, select and copy a row of data and paste it into one central workbook. That's all it does - in all, the macro does this routine for about 150 separate workbooks (and puts the rows of data all into the one central workbook).

My problem is this: Each of those 150 workbooks has links to another application and when each workbook is opened it takes a second or two for the links to update.

Unfortunatley, my Macro is too quick and copies the row of data before it has had a chance to update (so it just copies a row of #N/A's and no data!!!)

Ideally, I need my macro to open the workbook and then pause for say 3 seconds (so the workbook can have a chance to update its links) and THEN copy the data and carry on with the rest of the routine?

Is there some sort of timer function or a pause and resume command for a macro?

Anyone have any advice or suggestions to get round this problem?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Have a look at VBA help for "Wait", the example is pretty much what you're looking for. (I don't have Excel to bang something out for you today, sorry)

150 times 3 seconds is 450 secs, that's a long time.
 
Upvote 0
Hi Richard

The OnTime Method should help, try

Code:
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:00:05"), "CopyIt"
End Sub


Where "CopyIt" is your macro.
 
Upvote 0
Thanks Mark - I was searching in VBA help for "pause" "delay" "suspend" and everything else under the sun - except wait!!!

Cheers!
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,382
Members
448,889
Latest member
TS_711

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top