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
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,207
Office Version
  1. 365
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,108,810
Messages
5,525,008
Members
409,615
Latest member
papaluigi94

This Week's Hot Topics

Top