Simple (hopefully) DoEvents Question

JeffK627

Active Member
Joined
Jun 22, 2005
Messages
313
If Application.ScreenUpdating is set to False, will DoEvents override it and cause the screen to be updated anyway?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I think not, because DoEvents is nothing to do with screen updating. From the VB Help:

"Yields execution so that the operating system can process other events.

DoEvents passes control to the operating system. Control is returned after the operating system has finished processing the events in its queue and all keys in the SendKeys queue have been sent."
 
Upvote 0
I suppose it could, depending on what events are being done.

You don't mention what is being done, so hard to tell.

PS That might be why there weren't many responses.:)
 
Upvote 0
You can test it fairly easily. Run the test procedure - the screen doesn't update even though Doevents is called.

Code:
Sub test()

    Dim r As Long, c As Long
    Application.ScreenUpdating = False

    For r = 1 To 20

        For c = 1 To 20


            Cells(r, c) = Int(Rnd() * 1000)
            waitabit


        Next c

    Next r


Application.ScreenUpdating = True


End Sub

Sub waitabit()
    Dim t As Single

    t = Timer

    While Timer < t + 0.01
        DoEvents
    Wend
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,462
Members
452,915
Latest member
hannnahheileen

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