Copying data

Brighton

New Member
Joined
Aug 20, 2009
Messages
9
I've been trying for a while to write a code that will copy the data between two workbooks (lets say A and B) but will only copy columns A2:T2 and then down the used range. I am unsure as how to state that in the code.

Does anyone have any examples of code they got to work for copying between workbooks in Excel?

This is something I have to run once a month for monthly reports.
 
Something like this perhaps

Code:
Sub Sheet1_2()
Const wb2 As String = "Master"
Dim LR As Long, ALR As Long, ws As Worksheet
For Each ws In Worksheets(Array("Sanford", "Fred", "Scuttle"))
    With ws
        LR = .Cells(Rows.Count, 1).End(xlUp).Row + 1
        ALR = Sheets(wb2).Cells(Rows.Count, 1).End(xlUp).Row + 1
        .Range("A2:T" & LR).Copy Destination:=Sheets(wb2).Range("A" & ALR)
    End With
Next ws
End Sub
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I am using it to copy from BSanford to Master and I need to add in other sheets that will copy to the Master without overwriting the previous sheets copied.
 
Upvote 0
Thanks all! This place is awesome. I fell like an idiot not being able to figure this out but I am really grateful.
 
Upvote 0

Forum statistics

Threads
1,215,472
Messages
6,125,011
Members
449,204
Latest member
tungnmqn90

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