I wonder if there is a macro that groups objects?

Hi everybody.
I have 1 problem please help.

I think there must be a macro to solve them.

My job is to select objects and run macros. Macros will automatically group objects together without affecting their properties

As illustrated below. I want 4 objects that will form 4 independent groups

Parents Reply Children