+ Reply to Thread
Results 1 to 6 of 6

Copy Data from one workbook into another based on criteria

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Copy Data from one workbook into another based on criteria

    I have two workbooks:
    WB1= SourceWB
    WB2 = DestinationWB

    I am trying to copy data out of the SourceWB into the DestinationWB, as long as it meets certain criteria.

    The attached file serves only as a limited example, as the original SourceWB is over 3000 rows long (and dynamically changes), and contains over 200 columns of data.

    Basically, I would like to
    1) copy all rows/cells of data (excluding the header row) from Sheet1 of the SourceWB down to the point where I first encounter the word "Buckets", and then
    2) paste those values into Sheet1 of the DestinationWB.

    So in my attached workbook, this would involve copying the range B2:G15 of Sheet1...as B16 is where i first encounter the word "Buckets".
    (Alternatively, D16 is the first cell in Col D that is blank, so that also serves as a check for where the word "Buckets" first appears.)

    Again, these ranges are dynamic and much larger on the original workbooks.

    Any help would be extremely appreciated.
    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy Data from one workbook into another based on criteria

    Just this?

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113
    Xladept,

    What would you recommend is the best way to paste this range into workbook number 2?

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy Data from one workbook into another based on criteria

    You can paste directly if you know the destination. The other book name, the sheet on the other book and the leading range to paste it - if you know that, you can code the paste right into the same routine - if you have to open the object book then you need that information as well

  5. #5
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Copy Data from one workbook into another based on criteria

    I'll give it a shot.
    Thanks!

    I had to play around with the Copy and Paste code to get it to work for my use case, but now it works.

    Thanks again for all of the help!
    Last edited by hamidxa; 09-13-2017 at 11:45 AM.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy Data from one workbook into another based on criteria

    You're welcome and thanks for the rep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy Data to Another Excel WorkBook Based on Criteria Using VBA
    By bdrod in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 10-07-2016, 12:11 PM
  2. Replies: 2
    Last Post: 06-29-2016, 03:56 PM
  3. Copy and Paste Data from one Sheet to Other on different workbook based on Criteria
    By skonduru in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2016, 03:25 PM
  4. Copy Data from workbook into another based on certain criteria
    By Rossko7226637 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2015, 08:48 AM
  5. [SOLVED] Need code to copy data based on filter criteria to new workbook as save in a file location
    By msantucci in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-24-2015, 02:47 AM
  6. Copy cell value from 1 workbook to another workbook based on criteria
    By ezonemy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-15-2014, 04:02 AM
  7. Copy Data to New Workbook based on Criteria
    By jimbean in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2008, 03:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1