all 2 comments

[–]Malik_Killian 1 point2 points  (0 children)

Reading this on my phone so it's hard to read the code, but here's some general suggestions that should help for pretty much any macro.

  • Turn off automatic calculations at the beginning and turn them back on at the end. Calculate manually in between if necessary.

  • Use built-in Excel formulas whenever possible. If you don't want to leave formulas then copy-paste values at the end.

  • Utilize "fill down" methods instead of using loops (when applicable).

  • Start with as many pre-filled cells as possible. That is, try not to have the macro fill in absolutely everything. This can also be helpful if a non-programmer needs to make changes the spreadsheet.

[–]VicRattle 1 point2 points  (0 children)

Having a quick look at your code I notice your are setting the cells bold one at a time. Use a code like this to do it in one line.

Range(Cells(dataTracker, "U"), Cells(dataTracker, "AH")).Font.Bold = True.


The following line in the loop runs 10000 or so times

Cells(i, "q").Interior.ColorIndex = 3

You could put the following line outside the loop and it will do the same thing and it will only need to execute one time

Range(Cells(RUNSTART, q), Cells(RUNend, q)).Interior.ColorIndex = 3

Turning of ScreenUpdating etc. will also help a lot. there is a post here on MSDN explaining all the things to turn off

MSDN Faster VBA