I am trying to group all shapes on a sheet with the fiollowing code and getting the error:
"The Index into the specified collection is out of bounds"
Private Sub CommandButton1_Click()
Dim MyObject As OLEObject
Dim myobjectname As String
Dim myArr() As String
counter = -1
For Each MyObject In Sheets("Exhibit").OLEObjects
counter = counter + 1
ReDim Preserve myArr(0 To counter)
myArr(counter) = MyObject.Name
Next
ActiveSheet.Shapes.Range(Array(myArr)).Select
Selection.ShapeRange.Group.Select
End Sub
Bookmarks