Try this code - The sorting code was wrongly placed and that could be causing issues -
Option Explicit
Sub make_changes()
Dim Master As Workbook
Dim sourceBook As Workbook
Dim sourceData As Worksheet
Dim CurrentFileName As String
Dim myPath As String
Dim lrow As Long, i As Long
'The folder containing the files to be recap'd
myPath = "D:\Test"
'Finds the name of the first file of type .xls in the current directory
CurrentFileName = Dir(myPath & "\*.xls")
'Create a workbook for the recap report
Set Master = ThisWorkbook
Do
Workbooks.Open (myPath & "\" & CurrentFileName)
Set sourceBook = Workbooks(CurrentFileName)
Set sourceData = sourceBook.Worksheets("Database")
With sourceData
lrow = Master.Worksheets("Database").Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lrow
.Columns(1).Replace Master.Worksheets("Database").Range("A" & i).Value, Master.Worksheets("Database").Range("B" & i).Value, xlWhole
If Master.Worksheets("Database").Range("C" & i).Value <> "" Then .Range("A" & .Rows.Count).End(xlUp).Offset(1, 0).Value = Master.Worksheets("Database").Range("C" & i).Value
Next i
.Cells.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End With
sourceBook.Close
'Calling DIR w/o argument finds the next .xlsx file within the current directory.
CurrentFileName = Dir()
Loop While CurrentFileName <> ""
End Sub
Bookmarks