Download Workbook Example of Wait Message Macro
Got any Excel/VBA Questions? Free Excel Help
Ever had one of those macros that seem to take forever to complete? Recorded macros in particular generally take much longer than well written VBA code. Most users in this day and age expect code to run and complete almost instantaneously once they click 'the button'. Unfortunately, Excel VBA code is generally slower than a lot of other code types.
If this is a problem with your code we can have Excel display a "Please Wait" message to the user. This way they know that code is running and Excel has not locked up on them! Unfortunately, one of the more popular ways to let the user know that code is running is via the use of a progress meter. There are 2 problems with this method;
The method that I prefer is to use VBA code that makes use of a Rectangle from the Drawing Toolbar
Sub DoIt() Application.ScreenUpdating = True With Sheet1.Shapes("Rectangle 1") .Visible = msoTrue = (Not Sheet1.Shapes("Rectangle 1").Visible) End With 'Toggling sheets Forces Rectangle 1to show while code is running Sheet2.Select Sheet1.Select
End Sub
Run "Doit" Application.ScreenUpdating = False
The use of
Application.ScreenUpdating = False
See: Stop Screen Flicker and Speed up Macros
Run "Doit"
All you now need to do is run your macro as normal. You can of course use the macro in any Workbook simply by following the steps above.
See also:
Index to Excel VBA Code |
See also Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions.
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.