Copy data from workbook

Posted on 2011-04-20
Last Modified: 2012-05-11
Hi Experts,

I would like to request Experts help modify “SendToMaster_Out” module at CopyWB workbook to allow data at Column E copied to MainData Workbook at Column F. Currently only Column A to D (CopyWB) are copied at MainData workbook. Hope Experts will help me to add this function.

Question by:Cartillo
    LVL 35

    Accepted Solution

    Just a few code changes:

    With shtMaster
      Set rngMaster = .Range(.Cells(3, 1), .Cells(.Cells(.Rows.Count, "A").End(xlUp).Row, 6)) ' UPDATED TO 6
    End With
    With shtListing
      Set rngListing = .Range(.Cells(3, 1), .Cells(.Cells(.Rows.Count, "A").End(xlUp).Row, 5)) ' UPDATED TO 5
    End With

    Open in new window

    and in the copy data loop:
        rngMatch.Cells(IIf(i = 5, 6, i)).Value = rngWorking.Cells(i).Value ' UPDATED: fill column F with data from column E

    Open in new window

    Note: the loop already does i = 1 to 5
    LVL 8

    Assisted Solution

    Another option: Use Columns instead of Cells
      'Copy Data
      For i = 1 To 4
        'Fill the first 4 Rows
        'This can be expanded easily to accomidate more data
        rngMatch.Columns(i).Value = rngWorking.Columns(i).Value
      Next i
      'Add Store information to Column 5 (E) in Master
      rngMatch.Columns(5).Value = IIf(shtListing.Name = "Outgoing", "Pending", "Done")
      'Copy E column to F Column(Main)
      rngMatch.Columns(6).Value = rngWorking.Columns(5).Value

    Open in new window


    Author Closing Comment


    Thanks a lot for the help

    Author Comment

    Hi robert_schutt,

    Hope you'll consider this Q, intent to use the same solution for other workbook.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    Introduction This Article is a follow-up to my Mappit! Addin Article (, it was inspired by an email posting I made to EUSPRIG (, I will briefly cover: 1) An overvie…
    Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
    Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now