Does a shape cover a cell ?
There is no simple way of doing this. You have to get the Top, Left, Width,
and Length of both the cell and shape to determine if there is an overlap
Because the shape and cell are both rectangle you need to test all four
corners of the shape against al four sides of the cell to determine a partial
overlap
for the top left corner of the shape it would be something like this
'four corners of the shape
sxleft = shape.left
sytop = shape.top
sxright = sxleft + shape.width
sxbottom = sytop + shape.height
'four corners of the cell
cxleft = shape.left
cytop = shape.top
cxright = cxleft + shape.width
cxbottom = cytop + shape.height
if (sxleft = cxleft) and sxleft <= cxright) and
(sxtop = cxtop) and sxtop <= cxbottom) then
overlap is true
end if
now repeat for other three conditions of. Instead of sxleft and sxtop use
sxright and sxtop
sxleft and sxbotom
sxright and sxbotom
Only one of the 4 conditions needs to be met to determine overlap.
"Gary''s Student" wrote:
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
|