General Macro Speed Question

dturgel

Board Regular
Joined
Aug 6, 2015
Messages
58
I'm stumped on some code I'm running. I have two workbooks that are for all intents and purposes identical. I have a macro I am running in both of them that has identical code. In one workbook it takes six seconds, in the other 1 minute and 20 seconds. Does anyone have any general tips or ideas for me to check out that I may be missing that is causing one to take so much longer? I already compared the formulas and advanced tabs in excel options and those are identical. Anything else you would check out?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Is the data in both the same?

Is the file format the same?

Running on the same machine/server/network?

Did you copy the code from one into the other and get the differing results?

Look in VBA Manager, are there any hidden or very hidden sheets?
 
Upvote 0
Perhaps you have volatile formulas in the slow one that recalculate every time the macro writes to a worksheet.
 
Upvote 0
Thanks shg! I don't think that's going on here but just to verify, would I then see the following code in one and not the other:
Application.Volatile True
?
 
Upvote 0
Volatile formulas, not code (though UDFs could also be volatile, either by their coding or arguments).

Formulas that use TODAY, NOW, CELL, OFFSET, INDIRECT, or {SUM|COUNT|AVERAGE}IF(S) with improper references, are all volatile, which means they recalculate any time there is any change in any workbook, whether they need to or not.
 
Upvote 0
shg,
Thanks - I do have a ton of offset in the formulas and a little bit of sumif.
So how do I determine whether or not the references are improper (I'm sorry I don't know exactly what you mean by this). And then what do you recommend I do to alter this to accelerate the run?
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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