I need help speeding up my straightforward, 8-variable, nested loop macro. Each loop still takes ~1 second and there are a few hundred thousand loops to completion so it ta
Remember that each time you move/assign a value to a cell on a worksheet, Excel stops and recalculates the whole sheet again. @Joe's link to turn off this auto-calculation while you move your data will give you some speed boost. But...
Your loops would speed up tremendously if you perform all your calculations in the VBA routine instead of copying them to your worksheet and relying on your formulas to perform the calculations. Also, using memory-based arrays to hold your results can minimize how much your routine slows down for this copy. (Chip Pearson has a very good explanation of this.)
So my recommendations:
Dim results(1 to 44) as DoubleDim allResults(1 to 1000, 1 to 44) as Double -- (hint: you can't do this in a single statement, you'll have to loop to copy from the results array to the next slot in the allResults array). Then block copy the allResults array to a Range on your worksheet.You should get a large speed boost from these techniques.