Name

shape.Apply( )

Synopsis

Applies formatting that was previously picked up from another shape. The PickUp and Apply methods are used together to copy formatting from one shape to another. For example, the following code copies the formatting from the first shape on a worksheet to all of the others on the same worksheet:

Sub FormatSameAsFirst( )
    Dim ws As Worksheet, s As Shape
    Set ws = ActiveSheet
    For Each s In ws.Shapes
        ' Get formatting from first shape.
        ws.Shapes(1).PickUp
        ' Apply it to each shape.
        s.Apply
    Next
End Sub

Calling Apply clears the formatting being copied, so you must call PickUp before each Apply.

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.