Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell address nearest to screen coordinates
Quartz,
Here's a start at least: Sub test() Dim r As Long, c As Long Dim target_left As Double, target_top As Double Dim current_left As Double, current_top As Double c = 1 r = 1 current_left = 0 current_top = 0 target_top = 282.5 target_left = 436.27 While current_left < target_left If Sheet1.Cells(r, c).Left < target_left Then c = c + 1 Else While current_top < target_top If Sheet1.Cells(r, c).Top < target_top Then r = r + 1 Else With Sheet1.Cells(r, c) .Select MsgBox .Address & vbCr & _ "Top = " & .Top & "," & " Left = " & .Left Exit Sub End With End If Wend End If Wend End Sub hth, Doug Glancy "quartz" wrote in message ... Suppose I have a pair of screen coordinates as follows: Top = 282.5 and Left = 436.27 How can I obtain the address of the cell that is on or nearest to these coodinates? (doesn't need to be "exact" just close). TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I set up Excel to search nearest resource by address | Excel Worksheet Functions | |||
Simple way to convert UTM ED50 coordinates to decimal coordinates? | Excel Programming | |||
determining coordinates for screen placement of user form | Excel Programming | |||
Converting MouseDown Coordinates to Chart Point Coordinates | Excel Programming | |||
Screen Coordinates of a given cell in XL | Excel Programming |