![]() |
Pixel position of cell
Hi, I'm trying to get the pixel position of the active cell (or any cell for
that matter) so I can position the mouse cursor over it. So far I have worked out Application.Left gives the the position of the main window, Application.ActiveWindow.Left gives the position of the spreadsheet window but that is relative to the client area of the main window. I'm missing how do I get the position of the client area (the main window minus the borders, and toolbars, etc)? Also, I can get the position of the cell, but that is relative to the left of the first cell, how do I get it relative to the window? Thanks, Gary |
Pixel position of cell
On Oct 19, 5:55 am, Gary Smith <Gary wrote: Hi, I'm trying to get the pixel position of the active cell (or any cell for that matter) so I can position the mouse cursor over it. So far I have worked out Application.Left gives the the position of the main window, Application.ActiveWindow.Left gives the position of the spreadsheet window but that is relative to the client area of the main window. I'm missing how do I get the position of the client area (the main window minus the borders, and toolbars, etc)? Also, I can get the position of the cell, but that is relative to the left of the first cell, how do I get it relative to the window? Have you looked at the .Top/.Left/.Height/.Width properties of the Range object? I.e. |
Pixel position of cell
On Oct 19, 1:25 pm, "Mike Woodhouse" wrote: On Oct 19, 5:55 am, Gary Smith <Gary wrote: Hi, I'm trying to get the pixel position of the active cell (or any cell for that matter) so I can position the mouse cursor over it. So far I have worked out Application.Left gives the the position of the main window, Application.ActiveWindow.Left gives the position of the spreadsheet window but that is relative to the client area of the main window. I'm missing how do I get the position of the client area (the main window minus the borders, and toolbars, etc)? Also, I can get the position of the cell, but that is relative to the left of the first cell, how do I get it relative to the window?Have you looked at the .Top/.Left/.Height/.Width properties of the Range object? I.e. (Oops : premature "Send" button there) Dim itsTop As Single, itsLeft As Single ' Assuming Selection is a single cell, suitable checks omitted With Selection itsTop = .Top itsLeft = .Left End With HTH, Mike |
All times are GMT +1. The time now is 04:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com