OK, here is some code that I produced to do a similar type of job, except this one uses browsing to find & open the Folder and searches through any worksheets in the workbooks to find the data.
Sub ListFiles()
Dim Coll_Docs As New Collection, Search_path, Search_Filter, Search_Fullname As String
Dim DocName As String, i As Long, directory As String, ws1 As Worksheet, lastrow2 As Long
Dim name As String, wb As Workbook, ws As Worksheet, lastrow As Long, count As Integer
Dim monthcount As Integer, bookname As String, sheetname As String, filecount As Integer
Dim ws0 As Worksheet
Msg = "Select a location containing the files you want to list."
Set ws1 = Sheets("Sheet1")
Set ws0 = Sheets("Sheet2")
directory = GetDirectory(Msg)
If directory = "" Then Exit Sub
' Insert headers
r = 1
'Cells.ClearContents
ws1.Cells(r, 1) = "FileName"
r = r + 1
Search_path = directory ' where ?
Search_Filter = "*.xls" ' what ?
Set Coll_Docs = Nothing
DocName = Dir(Search_path & "\" & Search_Filter)
Do Until DocName = "" ' build the collection
Coll_Docs.Add Item:=DocName
DocName = Dir
Loop
With ws
For i = 1 To Coll_Docs.count '
Search_Fullname = Search_path & "\" & Coll_Docs(i)
ws1.Cells(r, 1) = Search_Fullname
r = r + 1
Next
End With
lastrow2 = ws1.Cells(Rows.count, 1).End(xlUp).Row
If lastrow2 = 1 Then Exit Sub
For filecount = 2 To lastrow2
lastrow = Cells(Rows.count, 1).End(xlUp).Row + 2
name = ws1.Cells(filecount, 1)
For count = Len(name) To 1 Step -1
If Mid(name, count, 1) = "\" Then
bookname = Right(name, Len(name) - count)
Exit For
End If
Next count
Workbooks.Open Filename:=name
Set wb = Workbooks(bookname)
For monthcount = 1 To 12
sheetname = ws0.Cells(5, 1 + monthcount)
Set ws = wb.Sheets(sheetname)
ws0.Cells(lastrow, 1) = ws.Cells(3, 3)
If ws.Cells(20, 10) = "Y" And ws.Cells(23, 10) = "Y" Then ws0.Cells(lastrow, 1 + monthcount).Interior.ColorIndex = 45 'orange
If ws.Cells(20, 10) = "N" Or ws.Cells(23, 10) = "N" Then ws0.Cells(lastrow, 1 + monthcount).Interior.ColorIndex = 3 'Red
If ws.Cells(21, 9) >= ws.Cells(19, 3) * 1.1 And ws.Cells(24, 9) >= ws.Cells(22, 3) * 1.1 Then ws0.Cells(lastrow, 1 + monthcount).Interior.ColorIndex = 4 'green
If ws.Cells(19, 3) = 0 And ws.Cells(22, 9) = 0 Then ws0.Cells(lastrow, 1 + monthcount).Interior.ColorIndex = -4142 'white
If ws.Cells(19, 3) > 0 And ws.Cells(22, 9) = 0 Then ws0.Cells(lastrow, 1 + monthcount).Interior.ColorIndex = -4142
Next monthcount
wb.Close (False)
Next filecount
End Sub
What is the location/name of your Folder?
By the way Access is a better method of data storage for the sort of job you are doing.