Application.ScreenUpdating toggle

I'm looking for the simplest way to toggle ScreenUpdating via call. Can you please advise if this solution could have any adverse effects?

Sub Toggle_Screen_Updating()
With Application
   .ScreenUpdating = IIf(.ScreenUpdating, False, True)
End with
End Sub

1 answer

  • answered 2021-06-10 11:00 Pᴇʜ

    This will toggle it.

    Application.ScreenUpdating = Not Application.ScreenUpdating
    

    I recommend not to use toggleing because you never clearly know the state after running this line. You only know that is is the opposite that it was before.

    I recommend to explicitly run Application.ScreenUpdating = False whenever you want to turn it off and Application.ScreenUpdating = True whenever you want to turn it on.

    I see no advantage in using a toggle instead.