Excel VBA Video Training/ EXCEL DASHBOARD REPORTS

Ozgrid, Experts in Microsoft Excel Spreadsheets

Excel: Please Wait Message for Slow or Long Running Excel Macros

 

Download Workbook Example of Wait Message Macro

See Also: Speed up Excel VBA Code and Issues: Oct 2002 , Nov 2002 , Dec 2002 of our Newsletter

Back to: Excel VBA . 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;

  1. The progress meter itself can slow down your code even more, compounding the problem.
  2. Your slow code must be because of a Loop and you cannot use the Macro recorder to create a Loop.

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

  1. To use the same code add a "Rectangle", from the Drawing Toolbar to any sheet in the appropriate Workbook.
  2. While it is selected, click in the Name Box (Left of formula Bar) and re-name it "Rectangle 1" (if it's not already)
  3. Enter the text you want displayed while your code is running and format the rectangle as desired.
  4. Position and size it as desired.
  5. Copy the macro "DoIt" above into a standard module of your Workbook.
  6. If needed, change "Sheet1" of the code to the CodeName of the Sheet you have placed "Rectangle 1" on. A sheets CodeName is the name NOT in parenthesis while looking in the Project Explorer of the VBE.
  7. Go to Tools>Macro>Macros and Run "DoIt" from within Excel. This will completely hide "Rectangle 1"
  8. At the very Start of the 'Slow Code' place
Run "Doit"

Application.ScreenUpdating = False

The use of

Application.ScreenUpdating = False

See: Stop Screen Flicker and Speed up Macros

  1. At the very end of your slow code simply place
    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.

Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money

Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.



Instant Download and Money Back Guarantee on Most Software

Excel VBA Video Training/ EXCEL DASHBOARD REPORTS

Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!

Microsoft � and Microsoft Excel � are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft

Some of our more popular products are below...
Convert Excel Spreadsheets To Webpages | Trading In Excel | Construction Estimators | Finance Templates & Add-ins Bundle | Code-VBA | Smart-VBA | Print-VBA | Excel Data Manipulation & Analysis | Convert MS Office Applications To...... | Analyzer Excel | Downloader Excel | MSSQL Migration Toolkit | Monte Carlo Add-in | Excel Costing Templates