Public Sub GPE()
Dim ChonO As Object, ChonF As Object, pFile, Path, ShMain As Worksheet
Dim fil As Object, Wb As Workbook, Sh As Worksheet, WbMain As Workbook
Dim Arr, dArr(1 To 65000, 1 To 45), I As Long, K As Long, J As Long, sArr
sArr = Array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 26, 28, 30, 31, 32, 34, _
35, 36, 37, 38, 39, 40, 41, 42, 43, 19, 21, 20, 24, 26, 28, 50, 51)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set WbMain = ActiveWorkbook
Set ShMain = WbMain.Sheets("02.Thay doi tinh trang")
pFile = WbMain.Name
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "CHON FOLDER"
.Show
If .SelectedItems.Count = 0 Then Exit Sub
Path = .SelectedItems(1) & "\"
End With
Set ChonO = CreateObject("Scripting.FilesystemObject")
Set ChonF = ChonO.GetFolder(Path)
For Each fil In ChonF.Files
If InStr(1, fil.Name, pFile) <= 0 Then
Set Wb = Workbooks.Open(fil.Path)
Set Sh = Wb.Sheets("02.Thay doi tinh trang")
Arr = Sh.Range("B5", Sh.Range("B65000").End(3)).Resize(, 51).Value
For I = 1 To UBound(Arr)
If Arr(I, 1) <> Empty Then
K = K + 1
dArr(K, 1) = K
For J = 0 To UBound(sArr)
dArr(K, J + 2) = Arr(I, sArr(J))
Next J
End If
Next I
Workbooks(fil.Name).Close
End If
Next fil
ShMain.Range("B5").Resize(65000, 45).ClearContents
If K Then ShMain.Range("B5").Resize(K, 45).Value = dArr
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub