VBA Change Cursor
To VBA change cursor in an application, you have the Application.Cursor property.
(To change the cursor on a UserForm, see below)
For the shape of the cursor, you have the choice of...
xlDefault
xlWait
xlBeam
xlNorthwestArrow
Here is an example for changing the cursor to an hourglass for the duration that the code is looping...
Sub vba_change_cursor()
Dim Counter As Long, Column As Integer
Application.Cursor = xlWait
For Counter = 1 To 5000
For Column = 1 To 3
Cells(Counter, Column) = "R: " & Counter & " C: " & Column
DoEvents
Next
Next
Application.Cursor = xlDefault
End Sub
VBA change cursor on a UserForm
On a UserForm, and subsequently, when hovering over the controls on the form, you have the choice of 15 cursor shapes...
To see them all, go to the View menu in the VBA IDE (VBA Editor) and click on Object Browser. Then, type fmMousePointer in the find box and click on the binoculars as in the figure below. When you click on each cursor, you can see its numerical value at the bottom of the list. In the image, you can see that the numerical value of the default cursor is 0. you can use the numerical value instead of the keyword in your code if you please.

|