Some (if not all) Excel versions redraw themselves completely if you set ScreenUpdating=true
. There is nothing you can do against it, I think.
You can, however, set ScreenUpdating
to false
and true
conditionally. Often, one executes code that only sometimes (or rarely) really changes data. So if the sheet update you do in your code only occasionally really does updates, you could init a flag to false
and then, set ScreenUpdating
to false
and the flag to true
only if the code really makes an update. As the final step after the updates, set ScreenUpdating
back to true
only if the flag is set.
This way, you would only see flicker for the cases where there really was a data change. This already might be sufficient to get rid of the flicker effects most of the time.
To avoid that remaining flicker completely, you could try locking the Excel window's interior using Windows API functions, perform your code as outlined, and unlock afterwards. This would still create a flicker effect, but invisibly, since the redraw process does not show. Upon unlock, the redraw takes still place, but without clearing rectangle areas with the background color.
ScreenUpdating
is reenabled, Excel redraws the screen. You cannot change that. Are you using Excel to display real time data? If so, you probably have the wrong tool for the job. – Steven Rumbalski