Hi
Welcome to board !!
Put this code in the master workbook.
adjust the sheet password in the code itself.Code:Option Explicit Sub kTest() Dim AllFiles() As String, i As Long, fn As String, r As Range Dim Wbk As Workbook, WkSht As Worksheet, lc As Long Const ShtPassword As String = "pwd" '<<< change the password here With Application.FileDialog(msoFileDialogFilePicker) .AllowMultiSelect = True .Filters.Add "Excel Files", "*.xls*" If .Show Then ReDim AllFiles(1 To .SelectedItems.Count) For i = 1 To .SelectedItems.Count AllFiles(i) = .SelectedItems(i) Next Else Exit Sub End If End With Application.ScreenUpdating = 0 With ThisWorkbook fn = .FullName With .Worksheets(1) lc = .Cells(1).CurrentRegion.Columns.Count lc = IIf(lc = 1, 1, lc + 1) Set r = .Cells(2, lc) End With End With For i = LBound(AllFiles) To UBound(AllFiles) If Not fn = AllFiles(i) Then Set Wbk = Workbooks.Open(AllFiles(i), 0) For Each WkSht In Wbk.Worksheets WkSht.Unprotect ShtPassword r.Resize(50, 2).Value = WkSht.Range("a1:b50").Value Set r = r.Offset(50) Next Wbk.Close 0 Set Wbk = Nothing End If Next Application.ScreenUpdating = 1 End Sub




Reply With Quote

Bookmarks