Group name change

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,132
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have this code and is all perfect. the only think to modify is that the group names should be the same.

After copu and paste the Group 1 and Group 2 and Group 4 names changes, is there a way so that the names don't change after copy and paste.


VBA Code:
Sub Macro1()

Dim Apath As String
Dim Aname As String
Dim AbSource As Workbook


Apath = ActiveWorkbook.Path  ' & "\" & "Okala RawFile Daily"
Aname = Dir(Apath & "\" & "Fixed Data.xlsx")


Windows("Okala Automation File.xlsm").Activate
ActiveWorkbook.Sheets("Region").Activate
ActiveSheet.Shapes.Range(Array("Group 1", "Group 2", "Group 4")).Select
Selection.Copy
    



Set AbSource = Workbooks.Open(Apath & "\" & Aname)
Windows(Aname).Activate
Sheets("Region BM").Activate

On Error Resume Next
ActiveSheet.Shapes.Range(Array("Group 1", "Group 2", "Group 4")).Select   'this name should be the same.
Selection.Delete


Range("A38").Select
ActiveSheet.Paste

End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Start by renaming “Group 1”, “Group 2”, “Group 3”, I suspect they are what Excel assigned to the group when you grouped the shapes.
So change to; “Group 1a”, “Group 2a”, “Group 3a” for example
That should preserve the Groups names when they are copied.
Experiment with doing a simple copy and paste of “Group 1”, you will find that the pasted “Group 1” is now NOT labelled “Group 1” but ie “Group 20”.
BUT if you copy and paste “Group 1a” the pasted group remains labelled “Group 1a”
 
Upvote 0
Solution

Forum statistics

Threads
1,223,711
Messages
6,174,020
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top