Change the cursor appearance to hourglass using VBA in Microsoft Excel

When you have a big vba macro / code which needs to run for many minutes, you can change the cursor to the hourglass or waiting cursor (based on your system setting) for the period when the macro is running.  Once the macro is completed, the cursor can be restored back to the default cursor.

This is a sample code which shows how you can change the cursor.

Option Explicit

Sub macro1()

Application.Cursor = xlWait

‘Code here

Application.Cursor = xlDefault

End Sub


  • After the dim statements (this sample code doesn’t have any yet), we set Application.Cursor = xlWait at the beginning of the code.


  • Then you can include whatever code you need to run.  If you need to call multiple subs / procedures, you can do so here or just have the entire code input here.


  • Then just before the End Sub statement, you need to reset the cursor back to the default.  We do this using the line Application.Cursor = xlDefault


  • You can include all the other statements you need like Application.ScreenUpdating = False or Application.DisplayAlerts = False  along with the Application.Cursor = xlWait statement.  Similarly, you can include Application.ScreenUpdating =True or Application.DisplayAlerts = True along with the Application.Cursor = xlDefault statement.


  • To copy this code, press the Alt + F11 keys on the keyboard. This will open the code module. On the left hand side you will see Microsoft Excel Objects.  Right click and select Insert and then select Module. Copy the code into the code window on the right.




Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.