But when i add two select lines to my macro, shown here, the screen updating begins and i cannot figure it out since i still have all of the screen updating code the same.
Your results will vary depending on your computer's specifications and a range of other factors but you should certainly see an improvement in performance when screen updates are turned off.Although the example above demonstrates the principle of the technique, it doesn't really reflect the type of code you're likely to write in the real world. The basic idea behind this example is to separate a list of films into separate worksheets based on each film's genre.I ran a test on my computer and when selecting cells the update occurs at the very end of the macro with screen updating set to false.Make sure your other macros have the line Okay, your solution worked for that fix, but i am still having another problem.The Screen Updating property resets at the end of a procedure.
This means that if you run a different subroutine after the one above and you haven't added the line of code to disable screen updates to it, you'll be able to see the screen updating in the background.
Although you can save a lot of time by turning screen updates off, you can also find performance gains by writing your code in such a way that Excel needs to update the screen as little as possible.
The easiest way to achieve this to avoid selecting or activating objects such as worksheets and ranges as much as possible.
One quick and easy technique to make your code run faster in Excel VBA is to simply prevent the screen from being redrawn each time something changes.
You can achieve this by using the Screen Updating property of the Application object.
If we want to quantify how much time we've saved we can add some code to create a basic timer system.