+ Reply to Thread
Results 1 to 7 of 7

Loop, Find, Copy, and Paste between multiple worksheets

  1. #1
    Registered User
    Join Date
    05-16-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    31

    Loop, Find, Copy, and Paste between multiple worksheets

    so, my dilemma is as follows. I am trying to create an "output" summary worksheet taking data from about 5 different worksheets and consolidating it into this one "Projections Summary".
    What I have it doing so far is adding the UniqueID's (Each entry in my workbook has a uniqueID) into Column A below row 3 (headers). Once that macro has run and pulled every UniqueID then I run a second macro that will loop through all of the UniqueID's pasted into Projections Summary, find it on a sheet named "pipeline" and now here's the catch, I want to be able to copy and paste the corresponding data from Pipeline to Projections Summary but the column orders are different. For Example

    Pipeline:

    A B C D E F G H I J K

    would need to copy to Projections Summary as:

    A E K B D C I H J F Etc etc.

    So this is where I'm stuck. I currently can run a loop and pull the value next to the uniqueID just using the offset function, but that's not going to cut it.

    - Part 2 -

    once the above has finished I want a 3rd macro to run and do roughly the same thing (search for the unique ID and copy and paste other data across) but luckily this is a pure copy and paste (same order on both worksheets), my problem that i'm running into on Part 2 is that I need it to search for this information between 5 other worksheets ("Alpha","Beta","Charlie","Delta","Echo") and I can't seem to figure out how to make it search through those 5 sheets since I've always just done either an entire workbook search or a single specific worksheet.

    Any help on either part would be great. Below is some of the code I'm using
    This part clears the worksheet "Projections Summary" and adds the unique ID's
    Please Login or Register  to view this content.
    Part 1 and 2 is where I need some help :\ thanks in advance

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Loop, Find, Copy, and Paste between multiple worksheets

    Could you upload a sample of you worksheet with the desired outcome manually inputted. Thanks!

  3. #3
    Registered User
    Join Date
    05-16-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Loop, Find, Copy, and Paste between multiple worksheets

    Ok, here is the sample sheet. you will see in the projections module the top code will run and clear all data except the headers and then import the UniqueID's. The second macro is one i was trying to figure out but I think its best to just scrap it and get a cleaner "best practices" type of code in there.
    Sample Workbook.xlsm

  4. #4
    Registered User
    Join Date
    05-16-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Loop, Find, Copy, and Paste between multiple worksheets

    ok,
    so here's the code i'm using to pull the cells across for part 1. However, if you run this from the sample workbook, for some reason they aren't matching up with their ID's, in fact its pulling data from different lines. Does anyone see where i may have messed up? I'm assuming its either with the loop function or the lastrow variable...
    Thanks in advance.
    Please Login or Register  to view this content.


    Sample Workbook.xlsm

  5. #5
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Loop, Find, Copy, and Paste between multiple worksheets

    Okay try this. I've attached your original workbook and altered the second code and added a private function. I have entered comments to help explain the code. Let me know if you have any questions.

    Thanks!
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-16-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Loop, Find, Copy, and Paste between multiple worksheets

    wow this is impressive. It's taking me some time to wrap my head around what it is doing exactly.

    if there are sheets that i want to exclude from being search, which part of the code would I add it to?

    for example a worksheet named "admin"

    Thanks

  7. #7
    Registered User
    Join Date
    05-16-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Loop, Find, Copy, and Paste between multiple worksheets

    I take that back, I figured it out

+ 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