View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Does a shape cover a cell ?

Thanks !!
--
Gary''s Student - gsnu200764


"Bernie Deitrick" wrote:

Gary's Student,

Function Cover(strShapeName As String, cAdd As String) As Variant
On Error GoTo ErrHandler
With Range(cAdd).Parent.Shapes(strShapeName)
Cover = Not Intersect(Range(cAdd), Range(.TopLeftCell, .BottomRightCell)) Is Nothing
End With
Exit Function
ErrHandler:
Cover = "Bad :-("
End Function


Sub TestTheFunction()
MsgBox Cover("Rectangle 1", "C4")
End Sub



--
HTH,
Bernie
MS Excel MVP


"Gary''s Student" wrote in message
...
I need a simple boolean function that, give the name of a shape and the
address of a single cell, will return TRUE if the cell is fully or partially
covered by the shape. Otherwise FALSE.

Thanks in advance
--
Gary''s Student - gsnu200764