+ Reply to Thread
Results 1 to 5 of 5

Copying rows from other sheets, and sort them based on a priority column

  1. #1
    Registered User
    Join Date
    03-25-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    2

    Copying rows from other sheets, and sort them based on a priority column

    Hi,

    I have a question I hope you can help me with.

    Attached is an Excel doc example of what I'm trying to do. The document I'm working on is obviously a lot bigger, with many more sheets etc.

    In the two sheets Source sheet 1 / Source sheet 2; I have a column (Priority) containg a numerical value 1, 2, 3, 4 or 5 for each row.

    In the sheet called Sorted Result, I want all the rows from the source sheets with a priority number sorted.
    I'm not too good at explaining things, so it's probably a lot easier to take a look at the example file, where I have created the Sorted Result sheet the way I want it to be

    Thanks in advance...
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: Copying rows from other sheets, and sort them based on a priority column

    It will take multiple steps.

    1. Write code to copy all data from source sheet 1 to sorted results sheet.

    2 Write code to copy all data from source sheet 2, identify last used row on sorted results sheet, and paste this data after the last used row.

    3. Write code to sort data using code similar to following on sorted results sheet:-
    Please Login or Register  to view this content.
    hth
    Ajay

  3. #3
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying rows from other sheets, and sort them based on a priority column

    1) Right-click on the sheet tab where you want this consolidation occur.
    2) Select View Code
    3) Paste in the sheet-event macro into the sheet module that appears:
    Please Login or Register  to view this content.

    4) Close the editor and save your workbook as a macro-enabled workbook (???.xlsm)
    5) Now switch to a different sheet, then back to that sheet...the list will reassert itself each time
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    03-25-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Copying rows from other sheets, and sort them based on a priority column

    Thank you very much, both of you!

    I'll see what I come up with

  5. #5
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying rows from other sheets, and sort them based on a priority column

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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