Pull Data from Multiple Excel Files into a Summary Excel File to Create Graphs

ThomasE

New Member
Joined
Nov 15, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have a set of Excel sheets that are outputs from different tests. There are 9 raw data files, and they are sequenced by when the test was conducted.

001_X_PreSine.xlsx
002_X_Random.xlsx
003_X_PostSine.xlsx
004_Y_PreSine.xlsx
005_Y_Random.xlsx
006_Y_PostSine.xlsx
007_Z_PreSine.xlsx
008_Z_Random.xlsx
009_Z_PostSine.xlsx

X, Y, and Z in the file names above will always be grouped together, but the letters could be in any order (X, Y, Z / X, Z, Y / Y, Z, X / etc.).

I want to take the data from the PreSine and PostSine files, which always starts on line 25 and ends on line 2024 of the first sheet and graph the data showing PreSine and PostSine for the same axis (X, Y, Z) in the same graph.

For the graphs, the X-values come from column B, and Y-values come from column G, I, K, and M. Data labels would be "Control", "X-Response", "Y-Response", and "Z-Response" with a prefix of either "Pre Sine" or "Post Sine" as appropriate.

Is it possible to program this by having all of the raw data files and summary file with graphs in the same folder?
 

Attachments

  • Example Output Graph.png
    Example Output Graph.png
    82.5 KB · Views: 14
I have 2 modules - one with the primary code and a second with the operate code. When I run debug from the operate code, it does step into the main code and then it appears to find the first file (a PreSine), then find the second file (a Random), then opens the that single PreSine file (001_PreSine_X) and then has a message box with "LoadChartDataError". If I am following the code correctly, the exact file name will not matter as long as it does not have the word "Random" in it.

I did try removing the Random data files from the folder, but this did not help either. It still opened a single file.

I am happy to share a whole set of files with you and strip out customer data, but I am not sure the best way to get them to you.
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
The problem may be that the files to be imported do not have a sheet named "Customers". So as long as there is only 1 sheet per data file, this will work no matter what sheet name replaces "Customers". HTH. Dave
Replace...
VBA Code:
Set DataWs = WbSource.Worksheets("Customers")
with...
VBA Code:
Set DataWs = WbSource.Worksheets(1)
 
Upvote 0

Forum statistics

Threads
1,224,833
Messages
6,181,242
Members
453,026
Latest member
cknader

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