Copy and Paste Macro assistance

ryland00

Board Regular
Joined
Jun 13, 2014
Messages
76
Hello,

I have 2 separate workbooks, lets call them base and target. I need information copied and pasted from the base workbook into the target workbook, specifically columns D, K, R, Y, AF, AM, AT, BA, BH, BO, BV and CC. The workbooks are exactly the same, except the base has updated information in these columns. Within each workbook, there are about 95 different sheets (just want to reiterate they are set up exactly the same except for those columns) that I need copied from the base to the target. So, for instance, in each of the workbooks, the first sheet is B01019, then B01028, then B01035, etc etc etc. The reason this is needed is because the target workbook is my original workbook with all of my code, and the base is the one I sent to people without coding (in case you were curious).

Any help would be greatly appreciated as I have only really found information on taking many worksheets into one.

Thanks so much,

Ryan
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi
This should do what you're after (for columns D & K only)
Code:
Sub Macro1()

    Dim Ws As Variant

    For Each Ws In Workbooks("[COLOR=#ff0000]Base.xls[/COLOR]").Worksheets
        Ws.Columns("D").Copy Workbooks("[COLOR=#ff0000]Target.xls[/COLOR]").Worksheets(Ws.Name).Columns("D")
        Ws.Columns("K").Copy Workbooks("[COLOR=#ff0000]Target.xls[/COLOR]").Worksheets(Ws.Name).Columns("K")
    Next Ws
    
End Sub
You'll need to change the file names to suit, & add another line for each column you want to copy.
HTH
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,812
Members
449,048
Latest member
greyangel23

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