Excel でシェイプをサイズあわせするマクロ

複数のシェイプを選択してから実行すると、各シェイプのサイズを一番大きいやつに合わせる VBA マクロ。Excel 2000 で作成。

Public Sub ResizeAll()
    Dim oShape      As Object
    Dim nWidth      As Long
    Dim nHeight     As Long
    
    If TypeName(Application.Selection) = "DrawingObjects" Then
        For Each oShape In Application.Selection
            nWidth = Max(nWidth, oShape.Width)
            nHeight = Max(nHeight, oShape.Height)
        Next
        For Each oShape In Application.Selection
            oShape.Width = nWidth
            oShape.Height = nHeight
        Next
    End If
    
    
End Sub