Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Problems with the Application.ScreenUpdating = False command in VBA |
---|
Some people are experiencing problems when trying to suppress screen updates while macros are running in Excel VBA, under Windows 10. This blog gives one possible solution. |
It seems that there is an intermittent problem with this command in VBA:
'turn screen updating off
Application.ScreenUpdating = False
What this does (or rather, what it should do - and used to do) is (was?) to prevent the screen updating while a macro is (was?) running. So in a macro like the following one you wouldn't see the screen flashing as each number was added:
Sub ExampleOfProblem()
Dim i As Long
'start by turning screen updating off
Application.ScreenUpdating = False
'now do something which will take a while to execute
For n = 1 To 10000
Cells(n, 1).Select
ActiveCell.Value = n
Next n
Application.ScreenUpdating = True
End Sub
It appears that sometimes with Windows 10 and Excel 2016 or later the above command doesn't properly freeze the screen. All that we can suggest is a fix ike this:
Dim n As Long
'turn screen updating off, but also make Excel invisible
Application.ScreenUpdating = False
Application.Visible = False
For n = 1 To 10000
Cells(n, 1).Select
ActiveCell.Value = n
Next n
'redisplay Excel and turn screen updating back on
Application.ScreenUpdating = True
Application.Visible = True
This may not be that a good solution, because it wiil look as if Excel has closed down!
Can anyone throw any more light on this?
Some other pages relevant to the above blog include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.