Can I Arrange Objects from Shortest to Longest?

I'm wondering if there is a way to arrange all objects from shortest to longest without having to do it manually? Maybe a Macro? (Which I am a beginner at.) I work with names a lot, sometimes hundreds at a time, and I need to arrange them Like this. Doing that takes a lot of time and it seems like there is a better way. Does anyone know of anything I could do? Attached is a picture of what I'm trying to achieve. Thanks!

Parents
No Data
Reply
  • You could use something like this to get the objects in the correct order, top-to-bottom:

    Sub arrange_1()
    
    Dim sr As ShapeRange
    Dim lngCounter As Long
    
        Set sr = ActiveSelectionRange
        If sr.Count > 1 Then
            sr.Sort ("@shape1.com.sizewidth<@shape2.com.sizewidth")
            sr(1).TopY = sr.TopY
            For lngCounter = 2 To sr.Count
                sr(lngCounter).TopY = sr(lngCounter - 1).BottomY
            Next lngCounter
        Else
            MsgBox "Must have two or more objects selected.", vbInformation
        End If
    End Sub
    

    After doing that, you could move the top or bottom objects up or down, then use regular tools in Align and Distribute to distribute the objects as you wish.

Children