Disabling Screen Updating function is slowing down my macro

Martunis99

New Member
Joined
Aug 16, 2021
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Hi guys,

So I built a macro that copies some contents of files to one single sheet based on some cell values.
Since some of these files are extracted from a separate program that executes a few runs on different populations, the amount of data to be copied can sometimes amount to several thousand rows.

In an attempt to make the macro run faster, I put Application.ScreenUpdating = False in the beginning of my program and turned it back on again in the end.
However, when I disable screen updating the macro takes up to 3min to copy over 4 files, and when I don't disable screen updating the macro takes only 30sec to copy the exact same files.

Do you have any idea why in this instance disabling screen updating is actually making my macro slower?

(PS: I don't have any Select or Activates as advised and I tried to assign all my ranges to variables)

Thank you!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi. I know this is an old post, but I have experienced the same thing. I have a spreadsheet that runs simulation by calling a subroutine in a dll (a Fortran code compiled as dll). The dll returns a lot of data which I write into several sheets. In an attempt to speed it up, is set application.screenupdating=False before it writes all the data to the sheets, and then turn in back on. This slows down the execution of the routine with a factor in order 10-20 times. If I comment out the two lines with applicatoin.screenupdating=False and ..=True, then it runs very fast. I have Excel® for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20148) 64-bit.
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,603
Members
452,658
Latest member
GStorm

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