+ Reply to Thread
Results 1 to 4 of 4

XY Coordinates of activeCell?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-09-2009
    Location
    Cedar Hill, Tx
    MS-Off Ver
    Excel 2003
    Posts
    200

    Re: XY Coordinates of activeCell?

    Not in terms of cells but in terms of "twips" (I think) so that I can use that information to relocate my mouse to the active cells.

  2. #2
    Forum Contributor
    Join Date
    01-09-2009
    Location
    Cedar Hill, Tx
    MS-Off Ver
    Excel 2003
    Posts
    200

    Re: XY Coordinates of activeCell?

    I'm working in the current direction. It will reposition the mouse but not to the correct location. Any ideas where I'm going wrong?

    TIA.

    Bob

    Type pointapi
        x As Long
        y As Long
    End Type
    Declare Function GetCursorPos Lib "user32" (lpPoint As pointapi) As Long
    Declare Function SetCursorPos Lib "user32" (ByVal xx As Long, ByVal yy As Long) As Long
    Public pos As pointapi
    Sub Macro1()
        Dim x, y As Long
        
        GetCursorPos pos
        MsgBox "Cursor Pos.x = " + Str(pos.x)
        MsgBox "Cursor Pos.y = " + Str(pos.y)
        
        x = ActiveWindow.PointsToScreenPixelsX(ActiveWindow.ActiveCell.Top)
        y = ActiveWindow.PointsToScreenPixelsY(ActiveWindow.ActiveCell.Left)
        
        MsgBox "activeCell.top = " + Str(x)
        MsgBox "activeCell.left = " + Str(y)
        
        Call SetCursorPos(x, y)
        
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1