+ Reply to Thread
Results 1 to 10 of 10

Get mouse coordinates in chart

  1. #1
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Get mouse coordinates in chart

    I'm trying to make a lookup table from a efficiency chart found in a pdf. Cutting the chart and pasting is as background in a Excel chart is a good start, so far so good.

    Now I want to use VBA to get mouse coordinates (and chart values) from the chart. It turned out to be very difficult.
    Either my calculations are way off or Excel is playing trick on me cause I just can't get the values correct, no way, no how....

    Please Login or Register  to view this content.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Get mouse coordinates in chart

    There is a addin to replicate the old graphical goal seek functionality. Perhaps you can make use of it
    https://blogs.office.com/2009/11/02/...ints-on-chart/
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Get mouse coordinates in chart

    Please Login or Register  to view this content.
    I don't have a solution for you, but just to let you know that X and Y values are not coordinates on the plot area. They are coordinates in the workbook window where (0,0) is the upper left corner just below the formula bar.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Get mouse coordinates in chart

    I know, that is why I subtract lPA (Left property of plot area) and wLA (Width property of left axis).
    Still, the numbers don't add upp AT ALL and I can't figure it out what is going on.

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Get mouse coordinates in chart

    Quote Originally Posted by Andy Pope View Post
    There is a addin to replicate the old graphical goal seek functionality. Perhaps you can make use of it
    https://blogs.office.com/2009/11/02/...ints-on-chart/
    Thanks for the tip Andy!
    However, I would expect a man with your resumé to solve this problem in a second. Only a few lines of code.
    Or do you have previous experience of this and know that is almost impossible?

  6. #6
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Get mouse coordinates in chart

    If I set the Plotarea Left property to 100, the plot area moves to that position just fine.
    However if I click around with the mouse pointer until I get x=100 then the mouse pointer is waaayy to the left of the plotarea. It's like they operate with different units or something. Is one pixels and the other points or something like that?

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Get mouse coordinates in chart

    It's a nightmare due to the different coordinate systems used.

    Regarding the addin. I had assumed that it was doing the adjustment graphical, as per the old way. But having just taken a look I see it uses controls on a userform.

  8. #8
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Get mouse coordinates in chart

    I believe you when you say it's a nigthmare. What I find strange is that no one has ever solved this problem before, to me it seems like a usable function.

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Get mouse coordinates in chart

    The simplest way would be to take a couple of sighting clicks first.
    If you click top left and bottom right of plot area you can then use mouse positions only

    Or maybe this approach would work.
    http://www.clearlyandsimply.com/clea...el-charts.html

  10. #10
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Get mouse coordinates in chart

    Thanks again. I think I'll leave this for now and get back to work, it's not critical.
    I would still be impressed and happy if someone suddenly posted a solution so I just leave this thread Unsolved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help - mouse click coordinates
    By pmlv in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-12-2017, 08:39 AM
  2. coordinates via mouse click
    By waynert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2014, 08:50 PM
  3. Finding the x y coordinates by using mouse over.
    By DNA007 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-16-2012, 06:33 PM
  4. Finding the x y coordinates by using mouse over.
    By DNA007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2012, 03:27 PM
  5. Mouse Coordinates in userform
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-31-2008, 04:57 AM
  6. Mouse X-Y Coordinates
    By Bob in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2006, 11:40 PM
  7. Mouse coordinates
    By Fustin François in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2005, 10:36 AM

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