Need Help with VBA, copy paste specific columns based on headers, Headers in the source varies

Dropzyl88

New Member
Joined
Jul 30, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi, I have 0 experience in VBA but I managed to write one that allows me to do the ff:
1. Browse and select and open files
2. Delete a specific column if it exists and copy the remaining column starting Row 5 and paste the result in a specific sheet

Now I need to revise it but I can't seem to find any similar issue on and off this forum:
1. There are 13 source data and most of them have different Headers in the destination tab
2. Out of the 24-30 columns, I only need to copy 7 specific columns
2. The first 5 Columns may be copied as A: E but for the 6th-7th Column it should be based on the header of the source

Source Data: If cell H5 is equal to "Nationalité" or I5 is equal to Nationality or K5 is equal to Nazionalità
Copy H6 or I6 or K6 up to the last row with data to Colum F of the destination Data

Source Data: If cell X5 is equal to "Edad" or Y5 is equal to âge or AA5 is equal to età
Copy X6 or Y6 or AA6 up to the last row with data to Colum G of the destination Data
 

Attachments

  • code.PNG
    code.PNG
    39.4 KB · Views: 33

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

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