VBA: Rename all Tables based on a list

zimza

New Member
Joined
Dec 7, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have multiple tables in a sheet (48 to be exact, they relate to a survey question) with the table name currently set as Question1, Question2, and so on.

I need to duplicate the sheet as each table of answers needs to relate only to the answers provided in a certain grouping (say, by manager) When duplicating, the table names lose their sequencing, so the duplicate version of Question24 is "Question2484". As there are 20-odd groupings, I want to avoid manually renaming everything.

I have pulled a list of all the relevant tables using a data query, so this is sat in a table called "Query1" (Column A, Header = "Name") I've added a column (Column B, header - "Correction") and added the new names (so the manager's initials and the question number, then let Fill Series do the work) So basically I need help creating a VBA that looks to see if the table is in the "Name" list, and if it is, rename it to the one in "Correction".

Or if anyone can recommend an alternative - I thought about renaming based on the worksheet name (which could be the managers initials) but couldn't work out how to get the numbering sequencing.

Can anyone help please?

I had created a mini-version but as it's telling me I need to install an add-in (I'm not able to) I can't share it
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

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