Rename header rows based on excel workbook names

LauraE

New Member
Joined
Jul 19, 2019
Messages
1
Hello
I have hundreds of separate excel workbooks saved in a single folder. Each workbook has the same set of 28 variables with the same header row titles and contains monthly data on the cost of drugs. I want to run a loop to merge these workbooks into one. There are two main issues (1) the first column contains the drug code which I want to match each workbook on in the master excel workbook (and additional drug codes can be added each month), and (2) the headers are all the same but I want to rename these by the excel workbook name before merging into the master excel workbook so that I have the the header rows as variable_a_jan_2018, variable_a_feb_2018, etc. Is it possible to run an excel macro loop to achieve this?
Any help would be greatly appreciated :)
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,224,609
Messages
6,179,874
Members
452,949
Latest member
Dupuhini

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