+ Reply to Thread
Results 1 to 7 of 7

Copy specific data from one workbook to another workbook if certain criteria

  1. #1
    Registered User
    Join Date
    05-11-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    7

    Copy specific data from one workbook to another workbook if certain criteria

    I am trying to copy certain data from one book to another.

    Example: If workbook "A" contains "PIR" in column "E" pull data from column K,D,C,O,R,S in that order and populate in seperate workbook cells A,B,C,D,E,K in that order. So K=A, D=B, C=C, O=D, R=E, S=K

    Somewhat new with macro's however comfortable with excel.

    Thanks in advance

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy specific data from one workbook to another workbook if certain criteria

    Hello ejschulte2001,

    This macro will take the data from the workbook the macro code is in and copy it over to another workbook that is already open. The name of the second workbook in the code is "Book2.xls". This will need to be changed to match workbook you will be using. The worksheet names are "Sheet1" for both workbooks. These can be changed if needed.
    Please Login or Register  to view this content.


    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    To Run the Macro...
    To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    05-11-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Copy specific data from one workbook to another workbook if certain criteria

    Thanks so much.....This is almost perfect....however I want it to post in the "next Available row" on the new workbook. Workbook 2 will basically be a data base of PIR issues pulled from a report that is ran each week. The report contains about 20 issues however I am only wanting to track and archive the PIR status so each week I'll be adding to an already existing data base. Any help with "next available row?
    Thanks in advance for all the help with this!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy specific data from one workbook to another workbook if certain criteria

    Hello ejschulte2001,

    This version will find the next available row in the second workbook.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-11-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Copy specific data from one workbook to another workbook if certain criteria

    Thanks Leith! I inserted the corrected code however It now errors me to this line
    Set RngEnd = DstWks.Cells.Find("*", , xlValue, xlWhole, xlByRows, xlPrevious, False)

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy specific data from one workbook to another workbook if certain criteria

    Hello ejschulte2001,

    If I could only type. The line should read...
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-11-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Copy specific data from one workbook to another workbook if certain criteria

    It works! Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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