cursor position

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi
I don't know which context you are looking for...
This is a windows screen cursor position.
Position 0 will be at the upper left hand corner of the screen, not the worksheet..
Ex NOT Cell A1
The only way I know how to capture the cursor location in the actual app would be to use an image box and capture the coordinates via the image's mouse move event.

Tom

Option Explicit

Type POINTAPI
x As Long
y As Long
End Type

Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long

Dim z As POINTAPI ' Declare variable

Sub GetCursor()
Range("A1") = "X = "
Range("A2") = "Y = "
Do
GetCursorPos z
Range("B1") = "x: " & z.x ' Get x co-ordinets
Range("B2") = "y: " & z.y ' Get y co-ordinets
DoEvents
Loop
End Sub
 
Upvote 0
On 2002-04-13 11:48, TsTom wrote:
Hi
I don't know which context you are looking for...
This is a windows screen cursor position.
Position 0 will be at the upper left hand corner of the screen, not the worksheet..
Ex NOT Cell A1
The only way I know how to capture the cursor location in the actual app would be to use an image box and capture the coordinates via the image's mouse move event.

Tom

Option Explicit

Type POINTAPI
x As Long
y As Long
End Type

Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long

Dim z As POINTAPI ' Declare variable

Sub GetCursor()
Range("A1") = "X = "
Range("A2") = "Y = "
Do
GetCursorPos z
Range("B1") = "x: " & z.x ' Get x co-ordinets
Range("B2") = "y: " & z.y ' Get y co-ordinets
DoEvents
Loop
End Sub

Just to Add to DK and Toms
Replace the Do with this;

<pre/>
MsgBox "To stop the prgm just select A1", vbSystemModal
Do Until ActiveCell.Address = "$A$1"
</pre>

This will give you the readings...then when
you want the prgm to Stop just place your
cursor @ A1.
 
Upvote 0

Forum statistics

Threads
1,214,400
Messages
6,119,292
Members
448,885
Latest member
LokiSonic

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top