Looping through a Collection of Shapes : Shape « Excel « VBA / Excel / Access / Word






Looping through a Collection of Shapes

 
Sub LoopThruShapes()
    Dim sh As Shape
    Dim I As Integer
    I = 1
    For Each sh In ActiveSheet.Shapes
        If sh.Type = msoLine Then
             Cells(I, 1).value = sh.name
             I = I + 1
        End If
    Next
End Sub

 








Related examples in the same category

1.Get shape and output its z order
2.Draw a star
3.Create a shape and set its color
4.Delete a shape
5.The OLEObjects Collection