How do I add a new shape to an Existing Shape Group in Excel VBA?

Viewed 408

I need help adding a new shape to an Existing Shape Group. Lets say I created a shapegroup after iterating through all shapes on Activesheet using the following code.

Set ShapeGroupX = ActiveSheet.Shapes.Range((x)).Group

Now if I add a new shape using Activesheet.shapes.AddShape and give it a unique name, how do I add this shape to ShapeGroupX without having to ungroup ShapeGroupX and group again?

1 Answers

I think you will need to Ungroup followed by Group:

Sub MakeBigGroup()
    With ActiveSheet.DrawingObjects
        .Ungroup
        .Group
     End With
End Sub
Related