Speed up my workbook

Bukol

Board Regular
Joined
Mar 31, 2002
Messages
55
Hi there
I am using Excel 2000.
I created a workbook with several macros which do the following:
From sheet 1, using a web query it extracts a table of data from an external website and puts it in a range of cells on sheet 1.
It then copies one by one 9 different cells from that range and pastes it into a different order on sheet 3.
Then using a list of keywords stored on sheet 2, it repeats the procedure but going to a different page on the website.
There are alltogether 26 cut or copy or paste actions involved in one run, which apparently slows everything down.
When I first started to run that thing, it extracted about 40 sets of data a minute. Then, after about 1000 runs, it slowed down to 1 set in 3 minutes!
I changed the code by adding a macro to cut the accumulated data on sheet 3 and pasted it into a second workbook. It helped a little, now I extract about 3 sets per minute. The speed is now constant. But not good enough. I have to extract 130000 sets of data, that would take me about a month of permanent running to extract them all!!!
Any idea how to speed that thing up?
If needed I would send you the complete code.
Hans
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi

Always best to post up codes so programers can have a once over..

resources are the key in windows OP enviorments and this will be much of the issues..

check my posts previously from in for on these, or re post on this feed if perticula issues you need to ask
 
Upvote 0
Hi Hans,

Without seeing your code, it would be hard to determine exactly how to speed the routine.

The standards for calculation speed include:

1. Turn off screen updating
Application.ScreenUpdating = False

2. Turn off auto calc
Application.Calculation = xlCalculationManual

be careful with this one, though and be sure to turn it back to auto when necessary
Application.Calculation = xlCalculationAutomatic

3. Make your code as efficient as possible and never select anything unless required.

Search http://www.decisionmodels.com for a bunch of details about code efficiency.

I agree with Jack, though, on this one in that you'll get a better response if you post the code you are using.

HTH,
Jay
 
Upvote 0
I found out that I get the best speed when I first open the workbook and then extract about 20 addresses. After that it starts slowing down. So if I close the workbook again and open it again, it starts with the same efficient speed. I suppose that the many copy/cut and paste operations will be written somewhere to a back memory and once this is getting filled up the speed slows down. Any idea how I can prevent that or do I have to add a macro to close and reopen the workbook after lets say 20 - 25 runs, and how to do that?
Hans
 
Upvote 0
Hi Hans

I would guess your problem could be due to NOT bypassing the ClipBoard in Excel and hence filling it up..

Sheet1.Range("A1:A100").Copy Desination:=Sheet2.Range("A1")

Is the preffered way of copying/cutting in Excel.

I have many ways and means that can (and should) be used found here:

http://www.ozgrid.com/VBA/SpeedingUpVBACode.htm
 
Upvote 0
Dave
Thanks, it works fine. One more line I need though:
Cut and paste into a worksheet in another open workbook by avoiding the clipboard.
Hans
 
Upvote 0
Hi Hans

Try:

Code:
Sheet1.Range("A1:A100").Cut Destination:= _
Workbooks("Book1.xls").Sheets("Sheet2").Range("A1")

_________________
Kind Regards
Dave Hawley
OzGrid Business Applications
Microsoft Excel/VBA Training
OzGrid.BusApp.170x45.gif

This message was edited by Dave Hawley on 2002-04-07 06:35
 
Upvote 0
Thanks Dave,
It works again.
Let me run it overnight (it's now 11:30 PM in the Philippines), and I will see tomorrow whether the speed stay's constant.
Hans
 
Upvote 0
Hi Guys
Anybody who helped me on this one, THANKS.
Actuall, the solution was to delete the worksheet where the data where coming in after 100 runs, add a new sheet and do the next 100 runs.
It's running now with a speed of 40 sets of data per minute and thats beautiful.
Thanks again
Hans
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,162
Members
448,554
Latest member
Gleisner2

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