Macro runs slowly when performing formatting tasks
Macro runs slowly when performing formatting tasks
(OP)
I have a macro that automatically opens a handfull of files, cuts and pastes selected data into a master worksheet, and then plots the data. When I run the macro, it does everything correctly.
Towards the end of the macro, I've programmed it to do some formatting on the plot to get it into presentation-quality format. When the macro runs, it does this formatting EXTREMELY slowly, and the screen begins flashing.
Why is this? I find it strange that the macro runs very quickly while cutting and pasting large amounts of data (thousands of rows from each worksheet), but then bogs down when performing simple formatting commands!
I should state that I am a beginner with Excel macros. At this point, I just use the "record" feature to write the macros and then only do minor tinkering on the VBA code, if necessary.
Thanks,
Haf
Towards the end of the macro, I've programmed it to do some formatting on the plot to get it into presentation-quality format. When the macro runs, it does this formatting EXTREMELY slowly, and the screen begins flashing.
Why is this? I find it strange that the macro runs very quickly while cutting and pasting large amounts of data (thousands of rows from each worksheet), but then bogs down when performing simple formatting commands!
I should state that I am a beginner with Excel macros. At this point, I just use the "record" feature to write the macros and then only do minor tinkering on the VBA code, if necessary.
Thanks,
Haf
RE: Macro runs slowly when performing formatting tasks
Application.ScreenUpdating = False
At the end of your macro:
Application.ScreenUpdating = True
might help speed things up...