detect shape overlap?
Each shape has a .topleftcell and a .bottomrightcell property.
Maybe you can use that to determine where to put the next picture--or you could
look at each shape to see if any cell is shared between the two ranges:
Dim myShape1 as shape
dim myShape2 as shape
dim Rng1 as range
dim Rng2 as range
with worksheets("Sheet9999")
set myshape1 = .shapes(1)
set myshape2 = .shapes(2)
set rng1 = .range(myshape1.topleftcell,myshape1.bottomrightce ll)
set rng2 = .range(myshape2.topleftcell,myshape2.bottomrightce ll)
if intersect(rng1, rng2) is nothing then
'nothing in common
else
'do what you want
end if
end with
(Untested, uncompiled--watch for typos.)
SpaceCamel wrote:
I am automatically creating shapes within cells on a sheet but do not want
them overlaping. I do not know how many there will be within each cell.
Is the a way to determine if a new shape will overlap an existing one so it
can be shifted down out of the way?
Thanks,
--
Dave Peterson
|