Is there a faster way to replace objects?

Hello Community, in my work I have some templates ready where I need daily to replace only the barcodes. As in the picture. New barcode A > Old Barcode B.
Usually I select both barcodes, click C+E to center the barcodes, and delete the old one. But I would like to know if there is any way to make this faster. I tried to make a macro, but the macro deleted other template information and not the old barcode. If someone can help me, I appreciate it a lot. :)

Thank you

  • Recording macros can be useful, but sometimes you need to edit them or write the code "from scratch" to do what you want.

    Here is a simple macro sub that you could try:

    Sub replace_shape_HCenter_VCenter()
    Dim sr As ShapeRange
        Set sr = ActiveSelectionRange
        sr(1).AlignToShape cdrAlignVCenter, sr(2)
        sr(1).AlignToShape cdrAlignHCenter, sr(2)
    End Sub


    To use that macro, you would:

    1. Select the "old" barcode".
    2. Add the "new" barcode to the selection (so that they are both selected).
    3. Run the macro sub.