Pulling data-points from different workbooks

elpaco313

New Member
Joined
May 26, 2017
Messages
1
I have 57 data-points (per file) across 120 separate Excel files. Each point is in the same spot in each workbook. I have been searching everywhere for the past 3 hours on how to achieve this. I keep coming across the "INDIRECT" function, but not sure if that is the correct solution (and I don't know how to use it).

I already have a list of the file names compiled and in a sheet now, as well as the folder path.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
if the files are closed, indirect won't work.

let's say paths are in A and filenames in B... and you want to write the data in C... the data point is A1

Code:
Sub GetDataPoints()
    Dim r, endRow As Long
    endRow = Cells(Rows.Count, 1).End(xlUp).Row

   [COLOR=#008000] 'file path must look like this... C:\something\ ...make sure it has a trailing slash
    'file name must include extension
[/COLOR]
    For r = 2 To endRow
        Cells(r, 3) = "='" & Cells(r, 1) & "[" & Cells(r, 2) & "]'!A1"
    Next r
End Sub

you cant use indirect so you have to use vba to build the dynamic ranges
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

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