View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Juan Pablo González Juan Pablo González is offline
external usenet poster
 
Posts: 226
Default Does RangeFromPoint Method return ranges?

You just have to remember that the X and Y coordinates are (if I understand
correctly), for the entire application window, not just for the
spreadsheet... so, this:

?TypeName(ActiveWindow.RangeFromPoint(1,1))
Nothing

returns Nothing because most likely, the pixel (1, 1) is part of the caption
of the application, or at least, of the menu bar.

--
Regards

Juan Pablo González

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Sefano,

Actually, it will return a range. Run this on on empty workbook - I think
100 and 200 will be enough to get your coordinates onto the worksheet:

Set myRFP = ActiveWindow.RangeFromPoint(100, 200)
If Not myRFP Is Nothing Then
MsgBox "Hello from " & myRFP.Address
End If

In actual use, you would need to check to see if myRFP was a range or a
shape...

HTH,
Bernie
MS Excel MVP

"Stefano Gatto" wrote in message
...
The help on the RangeFromPoint Method of XL 2000 says:

Returns the Shape or Range object that is positioned at the specified

pair
of screen coordinates. If there isn't a shape located at the specified
coordinates, this method returns Nothing.

Can it return the range object or not? it looks like not (even if it

states it does)