Macro copy data from multi sheets to other workbook

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
471
Office Version
  1. 365
Platform
  1. Windows
Would you have a macro that would copy data from cells copy cells A70 to F130
from workbook1 sheets1,2,3,4,5,6,7,8,9,10
to workbook2 sheets 1,2,3,4,5,6,7,8,9,10.
So date from 1 goes to 1 , 2 goes to 2 etc.
My sheets are just called 1,2,3,4,5,6,7,8,9,10
Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hello,

VBA Code:
Sub COPY_BOOK_1_TO_2()
    Application.ScreenUpdating = False
    With ActiveWorkbook
        For MY_SHEETS = 1 To 10
            With Sheets(MY_SHEETS)
                .Range("A70:F130").Copy
                Workbooks("Book4").Sheets(MY_SHEETS).Range("A70").PasteSpecial (xlPasteAll)
            End With
        Next MY_SHEETS
    End With
    Application.ScreenUpdating = True
End Sub

you will need to change 'Book4' to your destination spreadsheet name.

Have made some assumptions, both workbooks are open and sheet/tab name 1 is the left most tab and they go in order.
 
Upvote 0
You can substiture the workbook names for the index numbers.
VBA Code:
Sub t()
For i = 1 To 10
  Workbooks(1).Sheets(CStr(i)).Range("A70:F130"),Copy Workbooks(2).Sheets(Cstr(i)).Range("A1")
Next
End Sub

If you want to copy to the same range of cells, why not just do a saveas to duplicate the source workbook?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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