How find maximum top+height property of a collection of shapes

C

Chet

Does anyone know how to find the highest top and height property from
a collection of shapes? Basically I am trying to find the bottom of
the lowest of a group of shapes in order to see how far downward on
the worksheet in order so that I can draw a vertical line on the same
worksheet but no lower than the lowest shape object on the worksheet.
Thanks much,

Chet
 
J

JE McGimpsey

One way, if I understand you correctly :

Public Sub LowestShape()
Dim nLowest As Long
Dim nTemp As Long
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
nTemp = sh.Top + sh.Height
If nTemp > nLowest Then nLowest = nTemp
Next sh
MsgBox "Height of line: " & nLowest
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top