Hi eljacinto,
Try:
(UNTESTED)
Come back with any questions.
ALSO NOTE: You're going to have to enable Microsoft Scripting runtime to use the .fso object.
Its easy, in the code window, click: Tools > References > 'Check the box "Microsoft Scripting Runtime"'
Sub Test()
Application.ScreenUpdating = False
Dim fso As New FileSystemObject ' Enables macro to search file explorer for files
Dim dataFiles As Variant ' String array that holds the file names
Dim qwp As Long ' Forloop variable
Dim WBT As Workbook
Dim WBD As Workbook
Dim WPN As Worksheet
Dim WSD As Worksheet
dataFiles = Application.GetOpenFilename("data Files(*.), *.)", 1, "Select ALL Desired Files.", "Select", True) ' Gets file names of shift/ctrl clicked files
Set WBT = ThisWorkbook
Set WPN = WBT.Sheets(1)
' Initializes counter variable
Counter = 0
' Sets counter equal to amount of dataFiles chosen
For qwp = LBound(dataFiles) To UBound(dataFiles)
Counter = Counter + 1
Next qwp
'Execute for every sample
For m = 1 To Counter
' Open Workbook with m'th string name from dataFiles string array
dataWorkbookFileName = fso.GetFileName(dataFiles(m)) ' Gets filename of file
Workbooks.Open dataFiles(m) ' Opens dataFile Workbook
Set WBD = Workbooks(dataWorkbookFileName)
Set WSD = WBD.Sheets(1)
Dim cArr(), rVal1 As Variant, rVal2 As Variant, rVal3 As Variant, rVal4 As Variant
With WSD
cArr = Range(.Cells(1, 3), .Cells(3, 3)).Value
rVal1 = .[E3].Value
rVal2 = .[C27].Value
rVal3 = .[D27].Value
rVal4 = .[E28].Value
End With
With WPN
.Cells(m + 5, 2).Value = cArr(1, 1)
.Cells(m + 5, 3).Value = cArr(2, 1)
.Cells(m + 5, 4).Value = cArr(3, 1)
.Cells(m + 5, 5).Value = rVal1
.Cells(m + 5, 6).Value = rVal2
.Cells(m + 5, 7).Value = rVal3
.Cells(m + 5, 8).Value = rVal4
End With
Application.DisplayAlerts = False
WBD.Close
Application.DisplayAlerts = True
Next m
Application.ScreenUpdating = True
End Sub