Help with VBA - How to extract multiple columns from multiple sheets from multiple workbooks

mrsbunnybunny1

New Member
Joined
Aug 12, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have about 50 files with data in columns A through G. All 50 files have different names but data is in worksheets named all the same. I am trying to get a VBA code to:

1. Open each of the 50 files.
2. copy columns c and e of file 1, Sheet 1
3. paste in the master workbook Sheet 1
4. copy columns c and e of file 2, Sheet 1
5. paste in the master workbook Sheet 1 to the right of the columns from file 1
6. copy columns c and e of file 3, Sheet 1
7. paste in the master workbook Sheet 1 to the right of the columns from file 2
[and so on and so forth until there are no more files]
8. copy columns c and e of file 1, Sheet 2
9. paste in the master workbook Sheet 2
10. copy columns c and e of file 2, Sheet 2
11. paste in the master workbook Sheet 2 to the right of the columns from file 1
[and so on and so forth until there are no more files and do so until there are no more sheets]

All can be value paste.

Can this be done? Thanks in advance.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

davesexcel

Well-known Member
Joined
Feb 26, 2006
Messages
1,325
Hit the mrexcel search button, look for "Loop through files in a folder"
 

Forum statistics

Threads
1,181,638
Messages
5,931,152
Members
436,777
Latest member
robk123

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
Top