VBA for copying data from multiple workbooks into 1 sheet

Camerutttt

New Member
Joined
Aug 1, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I have 1 master sheet and multiple excel files inside various different folders in a drive. I want to implement a button, such that when I click it, it will pull data from the selected files. (Since the excel files are all over the place inside a drive, I want to have the directories already pasted into the array. I think this will be easier than manually navigating to and selecting the file one by one.)

These files will have 2 column headers, ID and Date. Then, it will copy the ID and paste it into the master sheet only if the date is empty.

However the ID and Date columns are not in the same column range for every excel file. E.g. for excel sheet 1, ID and Date may be in Columns A and B. But for excel sheet 2 they may be in Columns E and G.

Each excel file has multiple sheets, but the columns ID and Date only exist in the first sheet called "Details". This applies to all excel files.

Alternatively it is also possible to copy the entire ID and Date columns, then use a filter to hide data with date values.

Thank you!!
 
Last edited by a moderator:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,224,243
Messages
6,177,374
Members
452,773
Latest member
D P

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