Copy data from all workbooks/sheets in a folder

photobeans

New Member
Joined
Apr 8, 2011
Messages
2
Hi all.

Here's what I'm trying to accomplish.

I have multiple workbooks in the same folder, and within each workbook will be a varying number of worksheets. The name of the worksheets will be based on a certain cell in each sheet, so they'll be dynamic. The layout of every sheet is exactly the same.

I want to be able to run a macro that will:
  1. Open every workbook in the folder
  2. Run through every worksheet for each book
  3. Copy data from a certain cell on each sheet
  4. Paste this data in a new workbook
I've tried tons of searches, and found code that would at least open each workbook in a folder, but I couldn't find anything that went through every sheet, or copied specific cells.

Anyone willing and able to set on the right course?

Thanks much in advance for reading!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
2) You want to refer to sheets based on their index value, not their name.

Code:
For each theSheet in ActiveWorkbook.Sheets
   'code involving theSheet
Next
Or

Code:
For i = 1 to ActiveWorkbook.Sheets.Count
   'code involving ActiveWorkbook.Sheets(i)
Next

3) How will you know which cells to copy?

4) Workbooks.Add
 
Upvote 0
Thanks for the reply.

I'll know the cells because there will be specific ones that will have the data I need. All the sheets will have the same layout, so I'll know which ones I want to get.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

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