Copy based on column names rather than letters?

TheWennerWoman

Active Member
Joined
Aug 1, 2019
Messages
303
Office Version
  1. 365
Platform
  1. Windows
We have a file supplied to us in a certain format by a third party. A macro then copies data from that file into our own file where it is then manipulated according to our needs.

This month the macro failed and when I investigated it turns out the structure of the third party file has changed (they've added columns)......my macro is expecting key data to be present in certain columns.

The third party say they can't guarantee that the file will remain in the same format forever so this is a potentially re-occurring problem.

So is it possible for me to copy data from that file based on column name?

Assume my file has columns alpha, beta, gamma, delta and epsilon. The third party file might have columns named alpha, beta, gamma, theta, delta and epsilon. So I'd want to ignore theta and just copy the others over.

Can this be done?

Thank you for reading.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Assuming those values are in a header row, you can use either Find or Application.Match to locate the column number for each header, then just copy those.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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