Maybe you have Excel 2007 and it allows you to select shapes on a sheet
in this way (Selection.ShapeRange (ie. a range of cells on a sheet
doesn't have its own range of shapes)). Not in Excel 2003.
A sheet has its collection of shapes, and you can define your own
shaperange to contain what shapes you like - you could even use each
shape's TopLeftCell and BottomRightCell properties to help you decide
which shapes to include.
The following bit of code puts the centre of each shape on the active
sheet on the centre of its TopLeftCell (a process which could well
change the TopLeftCell property of the shape, especially if the shape is
bigger than that cell):Sub blah()
For Each shp In ActiveSheet.Shapes
Set xxx = shp.TopLeftCell
shp.Top = xxx.Top + xxx.Height / 2 - shp.Height / 2
shp.Left = xxx.Left + xxx.Width / 2 - shp.Width / 2
Next shp
End Sub
and a way, perhaps, of narrowing down just which shapes you
want to move around:Sub blah()
For Each shp In ActiveSheet.Shapes
If Not Intersect(shp.TopLeftCell, Range("E11:BF100")) Is Nothing
Then
Set xxx = shp.TopLeftCell
shp.Top = xxx.Top + xxx.Height / 2 - shp.Height / 2
shp.Left = xxx.Left + xxx.Width / 2 - shp.Width / 2
End If
Next shp
End Sub
--
p45cal
*p45cal*
------------------------------------------------------------------------
p45cal's Profile:
http://www.thecodecage.com/forumz/member.php?userid=558
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=134999