Write a VBA Code and VLOOKUP Values from multiple excel files into a master sheet

Charles Wanda

New Member
Joined
Feb 2, 2022
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hi,

Grateful if anyone can help with this.

I have a set of production data which is reported on a daily basis (Image A: Report For January 1, 2022) i.e different excel Worksheets that represent production data for a specific day(date). There exist a specific folder on my desktop where all the reports are saved.
However, to consolidate these production data for the different days into a single master table/excel in a specific order as seen on Image B (Master Excel Sheet Table)), I have to manually enter the data. I realized this method is prone to mistakes.

Given that the daily reporting format for everyday remains the same, what VBA code can I use to automate the process?


Thanks in advance and I look forward to your responses.
 

Attachments

  • Master Excel Sheet Table.PNG
    Master Excel Sheet Table.PNG
    49.8 KB · Views: 26
  • Report For January 1, 2022.PNG
    Report For January 1, 2022.PNG
    28.3 KB · Views: 27

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
How is it not working for you? Does it do anything? Does it open the files? Click here to download your files. I tested the macro using the Jan. 1 - Jan 3 reports and it worked properly. Try these files and see if it works for you.
 
Upvote 0
Solution
This is what I got with the 3 files:
Master Sheet(Consolidated).xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1MASTER EXCEL SHEET TABLE
2CLASS1A1B2A2B3A4A4B5A5B6A
3DATEProduction- Production-RecycledProduction- Production-RecycledProduction- Production-RecycledProduction- Production-RecycledProduction- Production-RecycledProduction- Production-RecycledProduction- Production-RecycledProduction- Production-RecycledProduction- Production-RecycledProduction- Production-Recycled
4Gross Net Gross Net Gross Net Gross Net Gross Net Gross Net Gross Net Gross Net Gross Net Gross Net
5
6January 1, 20221008515150127.522.520017030250212.537.530025545350297.552.540034060450382.567.550042575550467.582.5
7January 2, 20225042.57.51008515150127.522.520017030250212.537.530025545350297.552.540034060450382.567.550042575
8January 3, 20227866.311.7128108.819.2178151.326.7228193.834.2278236.341.7328278.849.2378321.356.7428363.864.2478406.371.7528448.879.2
9January 4, 2022
10January 5, 2022
11January 6, 2022
12January 7, 2022
13January 8, 2022
14January 9, 2022
15January 10, 2022
Sheet1
 
Upvote 0
How is it not working for you? Does it do anything? Does it open the files? Click here to download your files. I tested the macro using the Jan. 1 - Jan 3 reports and it worked properly. Try these files and see if it works for you.
It doesn't open any of the files. I would try this which you've shared and see if it works for me. Thanks
 
Upvote 0
Make sure that the folder path in the code is correct and that the files have an ".xlsx" extension.
 
Upvote 0
Make sure that the folder path in the code is correct and that the files have an ".xlsx" extension.
Hi Mumps, I am able to run the VBA code now and it works properly. I had to change the file path to my desktop and it works. I am not so sure why it doesn't work with the other. I am grateful for your assistance. Thanks a lot.

I have a similar problem consolidating another data with more entries than this. I would try applying your code to if it works. Please permit me to say I would revert if I need further assistance with this or anything else.

Thanks once again.
 
Upvote 0
You are very welcome. :)
Dear Mumps, Thanks a lot for your assistance with the macro.
I however have something similar to the previous but a little bit more complicated. I tried modifying the macro to work for this but I couldn't.

A description document and other files to what I am trying to achieve is found on the attached link. I would be grateful once again for your assistance. Test_Folder
 
Upvote 0
What you are asking is a little more involved. I will be busy for the next few days. I will have a closer look at it when I get some time and see if there is anything I can do.
 
Upvote 0
What you are asking is a little more involved. I will be busy for the next few days. I will have a closer look at it when I get some time and see if there is anything I can do.
Not a problem. Anytime most convenient by you works for me. Thanks a lot.
 
Upvote 0

Forum statistics

Threads
1,215,424
Messages
6,124,817
Members
449,190
Latest member
rscraig11

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