VBA to pull data from closed workbooks

RE Dev

New Member
Joined
Mar 11, 2015
Messages
6
First off, I have read several threads and thought I was getting close to piecing it together, but cannot figure it out, so I am hoping someone has a solution they'd be kind enough to share. I am trying to pull data from closed workbooks within the same folder to a summary/destination workbook. All of the excel files are from the same template, so they have the same worksheet names, same named ranges I need to pull, etc. I'd like to ideally have the macro search all excel files within the folder and paste those values into my destination workbook in separate rows. One example is a named range of "Project_Name".

Additionally, we store our files on onedrive, so if it's possible to incorporate code to determine the local path instead of the onedrive path, that would be phenomenal, but if not, I think I can source that code and modify your solutions to fix that piece. Thanks!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I may or may not have the answer you are seeking. One thing that would assist me and other volunteers is if you posted a copy example of your proposed "Destination Workbook" where what is copied from the other workbooks will be pasted as the "Master Workbook". Provide a few lines of 'mock up data' how the pasted data will look.

Also provide an example (mock up) of one of the workbooks that will be copied from. Please have that data match an example shown in the Destination Workbook.

This forum doesn't provide a means to include files with your postings. You'll need to post your example workbooks to a 'cloud website' and provide the download link here.

Thanks
 
Upvote 0
Thank you for the feedback. I am trying to include a sample here, so hopefully it works. Ultimately, I am trying to pull data from the various source workbooks into a destination workbook without having to manually link each cell from each source workbook. In this example, I am looking for sales by month of each project (each it's own source workbook) and then displaying these sales in the destination workbook by showing each project by month and then summing them for the total sales per month.

Example problem for mr excel.xlsx
ABCDEFG
2DESTINATION WORKBOOK
3
41/1/20242/1/20243/1/20244/1/20245/1/20246/1/2024
51/31/20242/29/20243/31/20244/30/20245/31/20246/30/2024
6Sales
7Project 110015011520030089
8Project 200100150115200
9Total Sales100150215350415289
10
11SOURCE WORKBOOK (Project 1)
12Project NameProject 1<- this would be a named range "Project_Name"
13
141/1/20242/1/20243/1/20244/1/20245/1/20246/1/2024
151/31/20242/29/20243/31/20244/30/20245/31/20246/30/2024
16Sales10015011520030089
17
18
19SOURCE WORKBOOK (Project 2)
20Project NameProject 2<- this would be a named range "Project_Name"
21
223/1/20244/1/20245/1/20246/1/20247/1/20248/1/2024
233/31/20244/30/20245/31/20246/30/20247/31/20248/31/2024
24Sales10015011520030089
Sheet1
Cell Formulas
RangeFormula
C4:G4,C22:G22,C14:G14C4=+B5+1
B5:G5,B23:G23,B15:G15B5=EOMONTH(B4,0)
B7:G7B7=B16
D8:G8D8=+B24
B9:G9B9=SUM(B7:B8)
 
Upvote 0
Please accept my apologies ... I am not able to complete a project that would answer your questions.

Perhaps someone else is willing to try ?
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,107
Members
453,021
Latest member
Justyna 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