Copy Multiple Workbooks into One

sirmacademy

New Member
Joined
Aug 12, 2018
Messages
17
Hello, I need to write the VBA code make this easy. Range of A1:AN81 will put into or copy at the Range A+81. They are in the same folder. Thanks in advance.

Please see the code below.

Sub CopyPasteMultipleWorkbooks()
Workbooks.Open Filename:= _
"G:\My Drive\2018-2019 SF1\Grade 7\SF1_2018_Grade 7 (Year I) - ACACIA.xls"
Range("A1:AN81").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Consolidate Practice.xlsm").Activate
Range("A1").Select
ActiveSheet.Paste

Workbooks.Open Filename:= _
"G:\My Drive\2018-2019 SF1\Grade 7\SF1_2018_Grade 7 (Year I) - ALMOND.xls"
Range("A1:AN81").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Consolidate Practice.xlsm").Activate
Range("A" & 81).Select
ActiveSheet.Paste

Workbooks.Open Filename:= _
"G:\My Drive\2018-2019 SF1\Grade 7\SF1_2018_Grade 7 (Year I) - BREADFRUIT.xls"
Range("A1:AN81").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Consolidate Practice.xlsm").Activate
Range("A" & 162).Select
ActiveSheet.Paste

End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Place this macro in a standard module in the "Consolidate Practice.xlsm" workbook. Change the sheet name (in red) to match the name of the sheet where you want to paste the data.
Code:
Sub CopyPasteMultipleWorkbooks()
    Application.ScreenUpdating = False
    Dim desWS As Worksheet, wbArray As Variant, i As Long
    wbArray = Array("SF1_2018_Grade 7 (Year I) - ACACIA.xls", "SF1_2018_Grade 7 (Year I) - ALMOND.xls", "SF1_2018_Grade 7 (Year I) - BREADFRUIT.xls")
    Set desWS = ThisWorkbook.Sheets("[COLOR="#FF0000"]Sheet1[/COLOR]")
    For i = LBound(wbArray) To UBound(wbArray)
        Workbooks.Open Filename:="G:\My Drive\2018-2019 SF1\Grade 7\" & wbArray(i)
        Range("A1:AN81").Copy desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1, 0)
        ActiveWorkbook.Close False
    Next i
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top