This is the working code i started with below:
Then i just did Call LoopThruBooks1, Call LoopThruBooks2, Call LoopThruBooks3 etc.. 1-8 Loops to make the 8 columns of data i needed from 8 individual cells.
That works fine, Its 99% there and does what i need almost.. the only issue i have is when it pulls the data into my new doc and makes the column lists its not in alphabetical/numerical order like the doc names listed in the folder directory.
I'm pulling 8 individual cells from 2 different sheets within a workbook from many excel docs in a folder. So 4 cells from 1 sheet and 4 cells from another sheet within the workbook and making columns from those docs in the folder.
cell data from sheet2 named "Enter Info"
get C18 and put it in the B column
get C3 and put it in the C column
get C13 and put it in the D column
get C19 and put it in the E column
cell data from sheet1 named "Item Work Sheet"
get N5 and put it in the F column
get F2 and put it in the G column
get N4 and put it in the H column
get P4 and put it in the I column
I have something in column A already so i start entering the data in B, i also have it setup as a Table so i start the data on row 2 because row 1 has the Chart title names.
I started this info on this thread https://www.mrexcel.com/forum/excel...multiple-files-same-folder-3.html#post4928812 but it started becoming its own thing so i am posting it here as a new thread.
Please help!
Code:
Private Function GetValue(path, file, sheet, ref)
Dim arg As String
If Right(path, 1) <> "" Then path = path & ""
arg = "'" & path & "[" & file & "]" & sheet & "'!" & _
Range(ref).Range("A1").Address(, , xlR1C1)
GetValue = ExecuteExcel4Macro(arg)
End Function
Sub LoopThruBooks1()
Dim p, f, s, a, r
p = "C:\excelfolder"
f = Dir(p & "*.xls")
s = "Enter Info"
a = "C18"
r = 1
Do While f <> ""
r = r + 1
Range("B" & r) = GetValue(p, f, s, a)
f = Dir()
Loop
Sub LoopThruBooks2()
Dim p, f, s, a, r
p = "C:\excelfolder"
f = Dir(p & "*.xls")
s = "Enter Info"
a = "C3"
r = 1
Do While f <> ""
r = r + 1
Range("C" & r) = GetValue(p, f, s, a)
f = Dir()
Loop
End Sub
That works fine, Its 99% there and does what i need almost.. the only issue i have is when it pulls the data into my new doc and makes the column lists its not in alphabetical/numerical order like the doc names listed in the folder directory.
I'm pulling 8 individual cells from 2 different sheets within a workbook from many excel docs in a folder. So 4 cells from 1 sheet and 4 cells from another sheet within the workbook and making columns from those docs in the folder.
cell data from sheet2 named "Enter Info"
get C18 and put it in the B column
get C3 and put it in the C column
get C13 and put it in the D column
get C19 and put it in the E column
cell data from sheet1 named "Item Work Sheet"
get N5 and put it in the F column
get F2 and put it in the G column
get N4 and put it in the H column
get P4 and put it in the I column
I have something in column A already so i start entering the data in B, i also have it setup as a Table so i start the data on row 2 because row 1 has the Chart title names.
I started this info on this thread https://www.mrexcel.com/forum/excel...multiple-files-same-folder-3.html#post4928812 but it started becoming its own thing so i am posting it here as a new thread.
Please help!