Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set up Excel to search nearest resource by address mc303 Excel Worksheet Functions 4 December 13th 04 12:23 PM
Simple way to convert UTM ED50 coordinates to decimal coordinates? Dan[_38_] Excel Programming 8 July 11th 04 04:54 PM
determining coordinates for screen placement of user form PatFinegan[_10_] Excel Programming 2 January 31st 04 09:03 PM
Converting MouseDown Coordinates to Chart Point Coordinates Steve[_50_] Excel Programming 3 December 2nd 03 06:48 PM
Screen Coordinates of a given cell in XL hglamy[_2_] Excel Programming 2 October 15th 03 02:03 PM


All times are GMT +1. The time now is 01:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"