Try this macro:
Public Sub Read_Flies_WithoutNamedRange()
'this macro works woth named range in the template workbook.
Dim C_ell As Range
Dim File_to_Open As String, F_older As String
Dim Sh As Worksheet, Last_Row As Long
Dim Sh_Block As Worksheet
Application.ScreenUpdating = False
Set Sh = Sheets("Master file")
F_older = ActiveWorkbook.Path
Last_Row = Sh.Cells(Rows.Count, 1).End(xlUp).Offset(1).Row
File_to_Open = Dir(F_older & "\")
While File_to_Open <> ""
If InStr(1, File_to_Open, "Master", vbTextCompare) = 0 And _
InStr(1, File_to_Open, "Template", vbTextCompare) = 0 Then
Workbooks.Open (F_older & "\" & File_to_Open)
For Each Sh_Block In ActiveWorkbook.Worksheets
Sh_Block.Select
Sh_Block.Sort.SortFields.Clear
Sh_Block.Sort.SortFields.Add Key:=Range("A5") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With Sh_Block.Sort
.SetRange Range("E4", Cells(Rows.Count, 1).End(xlUp))
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("E5", Cells(Rows.Count, 1).End(xlUp)).Copy
Sh.Cells(Last_Row, 1).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Last_Row = Sh.Cells(Rows.Count, 1).End(xlUp).Offset(1).Row
Next
ActiveWorkbook.Close savechanges:=False
End If
File_to_Open = Dir
Wend
Application.ScreenUpdating = True
End Sub
This macro will disregard any file with the following word in its name: "Template" or "Master"
Put all the files in the same folder as your MASTER workbook. Your Master workbook will contain this macro.
Hope it works well for you.
Regards
Bookmarks