Macro to pull date from multiple workbooks in a single workbook

omeirm

New Member
Joined
Jun 27, 2016
Messages
9
Hello Everyone, I am trying to create a macro that will pull all the data from 80+ files into one sheet. In each of these 80 files they have individual names (ex: Upload_ABC, Upload_DEF,...) The date is in the 3rd tab of each sheet from A:T. I need a macro where I can put in the individual files in a top sheet. I can attach the end file template where the date needs to go in, just not sure how to attach it here. Any help is appreciated.

Thank you
Omeir
 
Re: Help with a macro to pull date from multiple workbooks in a single workbook

Thanks @mumps: I searched through the web and got some more info on this DIR. It is really great. Thanks for your guidance. I am still learning.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Re: Help with a macro to pull date from multiple workbooks in a single workbook

My pleasure. :)
 
Upvote 0
Re: Help with a macro to pull date from multiple workbooks in a single workbook

Thank you so Much!! it works great!. Any tips on where I should start as I do want to learn the basics of VBA and work my way from there.
 
Upvote 0
Re: Help with a macro to pull date from multiple workbooks in a single workbook

@mumps In an example on the use of DIR, 23 is used.
Code:
strFn = Dir(strPath & "*.*", 23)
I could not see any tutorial on this 23.
Your code works even in the absence of 23.
Kindly explain what is 23.
 
Upvote 0
Re: Help with a macro to pull date from multiple workbooks in a single workbook

Have a look at these 2 links:
https://www.exceltrick.com/formulas_macros/vba-dir-function/
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/dir-function
The number is a file attribute that defines what type of files and folders are returned. In the example you mentioned, the "23" is actually a sum of attributes (1, 2, 4, 16) so it would look for a folder and include system files, hidden files and read only files.
 
Upvote 0
Re: Help with a macro to pull date from multiple workbooks in a single workbook

Thanks for the valuable info @mumps.
Yes, if 23 is included it pulls "D:\$RECYCLE.BIN" and "D:\System Volume Information", which I wanted to avoid.
You have given the URLs of the very same sites which I already visited. I am glad that I am moving on the right direction. Thanks for the links.
In the table of attributes given in the msdn site, 23 was not mentioned. Thanks for informing that it is the addition of the selected attributes. Hope if I will exclude the attribute of the system file then the system file names wont be pulled.
Your explanation is of great help. Thanks.
 
Last edited:
Upvote 0
Re: Help with a macro to pull date from multiple workbooks in a single workbook

My pleasure. :)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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