Home
FREE DOWNLOADS
VBA Tutorials
VBA Code Samples
VBA Code - Excel
VBA for Beginners
Save Time on PC
SaveTimeWebsite
Save Time News
Save Time Blog
SaveTime SiteMap
Customer Service
Gibberish

Subscribe To
This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Add to Newsgator
Subscribe with Bloglines

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.

fmMousePointer in Object Browser








Google

Return from VBA Change Cursor to VBA Code Samples

Return to our Homepage



footer for vba change cursor page