![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 14
|
Excel macros do not offer the MouseMove event for Worksheets (it's only available over controls).
Any idea how to detect MouseMove some other way? Many thanks! (PS: Using Excel 97 & 2000) |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
You can use a simple Windows API call. Insert this code in a standard module and give it a go.
Code:
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Type POINTAPI
x As Long
y As Long
End Type
Sub GetTheCursorPosition()
Dim lngCurPos As POINTAPI
Do
GetCursorPos lngCurPos
Cells(1, 1).Value = "X = " & lngCurPos.x
Cells(2, 1).Value = "Y = " & lngCurPos.y
DoEvents
Loop
End Sub
D |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 14
|
Nice one, thank you.
I don't suppose you'd know how to detect when the mouse is over specific cells would you?! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|