For instance, any keys pressed while a function is running will be sent by Do Events The keyboard input will be processed before the screen is updated, so if you are changing cells on a spreadsheet by holding down one of the arrow keys on the keyboard, then the cell change event will keep firing before the main function finishes.
A User Form will not be refreshed in some cases, because Do Events will fire the events; however, Repaint will update the User Form and the user will see the changes on the screen even when another event immediately follows the previous event.
Description The improvement of screen Updating depends largely on how your macro is written.Screen Updating = True ''//Turn on screen updating End Sub Text boxes in worksheets are sometimes not updated when their text or formatting is changed, and even the Do Event command does not help.As there is no command in Excel to refresh a worksheet in the way a user form can be refreshed, it is necessary to use a trick to force Excel to update the screen.But the screen doesn't refresh, or stops refreshing at some point (e.g. The task eventually completes but the progress bar is useless. For i=1 to imax ' imax is usually 30 or so fraction Done=cdbl(i)/cdbl(imax) Application.Status Bar = Format(fraction Done, "0%") & "done..." ' or, alternatively: ' status Range.value = Format(fraction Done, "0%") & "done..." ' Some code.......Please follow the below steps to execute the VBA code to save the excel file. Step 2: Press Alt F11 – This will open the VBA Editor.Step 3: Insert a code module from then insert menu.So if your code is not updating too many sheets/cells but your workbook has many formulas then turning off the screen update might not help you at all. One more thing to consider for perfomance is Calculation property, set this to xl Calculation Manual to turnn off the auto recals and turn it back to xl Calculation Automatic at the end. Status Bar = Format(fraction Done, "0%") & " done..." ''// or, alternatively: ''// status Range.value = Format(fraction Done, "0%") & " done..." ''// Some code....... Display Status Bar = boo Status Bar State ''//Reset Status bar display setting Application.Status Bar = False ''//Return control of the Status bar to Excel Application.