Sub CopyRange()
Application.ScreenUpdating = False
Dim wsDest As Worksheet, wkbSource As Workbook, FolderName As String, lCol As Long, lRow As Long
Dim splt As Variant, FN As String, wbName As String, x As Long: x = 1
Set wsDest = ThisWorkbook.Sheets("Sheet1")
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Please select a folder"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count = 0 Then
MsgBox "You did not select a folder."
Exit Sub
End If
FolderName = .SelectedItems(1) & "\"
End With
ChDir FolderName
strExtension = Dir("*.xlsx")
Do While strExtension <> ""
Set wkbSource = Workbooks.Open(FolderName & strExtension)
splt = Split(FolderName, "\")
FN = splt(UBound(splt) - 1)
wbName = Split(wkbSource.Name, ".")(0)
If Not IsError(Evaluate("=ISREF('[" & wkbSource.Name & "]" & "EntryList" & "'!$A$1)")) Then
With Sheets("Entrylist")
If x = 1 Then
.Rows(1).EntireRow.Copy wsDest.Range("A1")
x = x + 1
lRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
lCol = .Cells(25, Columns.Count).End(xlToLeft).Column
.Range("A25").Resize(lRow - 24, lCol).Copy wsDest.Range("B2")
wsDest.Range("A2").Resize(lRow - 24) = FN & "-" & wbName
Else
lRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
lCol = .Cells(25, Columns.Count).End(xlToLeft).Column
.Range("A25").Resize(lRow - 24, lCol).Copy wsDest.Cells(wsDest.Rows.Count, "B").End(xlUp).Offset(1)
wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1).Resize(lRow - 24) = FN & "-" & wbName
End If
End With
End If
wkbSource.Close False
strExtension = Dir
Loop
wsDest.Name = FN & "-EntryList"
Application.ScreenUpdating = True
End Sub