+ Reply to Thread
Results 1 to 11 of 11

Copying entire rows to a different sheet based on multiple conidtions

  1. #1
    Registered User
    Join Date
    04-02-2016
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2016
    Posts
    18

    Copying entire rows to a different sheet based on multiple conidtions

    Hi all,

    I've got a workbook that I've been playing with. I've got macros already installed on a few tabs (I'm guessing I probably could have used one macro to do the whole lot but wasn't sure how so I'm up to 12 separate modules so far I think), but not sure where to begin on the big one....

    As below, this is how I want it to work:

    1. Information imported from a retail system into the "Orders" sheet
    2. Information moved from "Orders" sheet to "CURRENT ORDERS" sheet using the "Import Orders" macro button -I've done this bit and it seems work fine
    3. This is where I'm stuck. I want another macro button ("Sort Orders") to copy an entire row to the next blank row on a different sheet, depending on the criteria in columns "F" and "K" and then delete the line from the "Current Orders" sheet i.e if F14 contains the word "Raid" and K14 contains the word "Xbox", then entire line is copied to the next blank row in the "XB Raids" sheet and then this line is deleted from the "Current Orders" sheet. BUT, some lines won't need the criteria in column "K" i.e if F14 contains the word "Iron", the whole line gets copied to the "Iron Banner" sheet and then this line is deleted. There are 9-10 criteria that could be met in column "F", but only 2 (or no) options for column "K".
    4. In the other sheets, each lines' status can be changed via a dropbox, which changes the colour of the line
    5. Using the "Complete Orders" macro button on the other tabs, any row with a staus of "Complete" is fed over to the "COMPLETED ORDERS" sheet and then deleted -I've done this bit and it seems to work fine also

    I started writing a code for Step 3 using the code that I used in Step 5 but I just don't know how to incorporate the criteria and then get it to go to the right place.
    Also, each sheet that has a "Complete Orders" macro button feeds onto the same sheet, but as I mentioned earlier I've used a separate module/macro for each one. I'm sure there's probably a better way to do it (using one), but I wasn't sure how.

    Is what I want to do even possible?? Any help/suggestions much appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi WA Kiwi

    Welcome to the Forum!!!
    You could probably use Select Case Code in one Macro for this exercise. What are the 9-10 Criteria?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi there,


    Also, each sheet that has a "Complete Orders" macro button feeds onto the same sheet, but as I mentioned earlier I've used a separate module/macro for each one. I'm sure there's probably a better way to do it (using one), but I wasn't sure how.

    The following routine can be called from the "Complete Orders" button on any of the specific game worksheets.

    Please Login or Register  to view this content.
    The highlighted values can be changed to suit your own requirements.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  4. #4
    Registered User
    Join Date
    04-02-2016
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi Jaslake,

    It seems I can't count and there are actually 13! Although some may be added also over time.
    The Criteria are these words:

    "Monthly" (needs to be the first done to overrule any other words). Would move to one of the Monthly sheets dependant on Column K
    "Challenge". Would move to one of the Raids sheets dependant on Column K
    "Hire". Would move to the Private Lessons sheet
    "Iron". Would move to the Iron Banner sheet
    "Lesson". Would move to the Private Lessons sheet
    "Level". Would move to the Levelling sheets
    "Raid". Would move to one of the Raids sheets dependant on Column K
    "Spindle". Would move to the Spindle sheet
    "Story". Would move to the Levelling sheet
    "Sword". Would move to the Swords sheet
    "Test. Would move to the Levelling sheet
    "Trials". Would move to one of the Trials sheets dependant on Column K
    "Vault". Would move to one of the Raids sheets dependant on Column K

  5. #5
    Registered User
    Join Date
    04-02-2016
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi Greg,

    Thanks for that. I'll give it a try!

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi WA Kiwi

    What does this tell me...what are the Dependencies?
    dependant on Column K

  7. #7
    Registered User
    Join Date
    04-02-2016
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi Jaslake,

    There are going to be 2 x options in a dropbox in column K -Xbox or Playstation, so those for example:

    If F contains "Monthly" and K contains "Xbox" I want the whole line to copy over to the "XB Monthly" sheet. If K contains "Playstation", it should feed over to the "PS Monthly" sheet. And so on.

    I thought about splitting everything by Xbox or Playstation first into another sheet and then re-sorting from there but was hoping to cut out that step if possible....

    Thanks

    Kiwi

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Copying entire rows to a different sheet based on multiple conidtions

    This should give you the idea...
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-02-2016
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi Jindon,

    That worked PERFECTLY!
    I'll have a play and see if I can get all the information feeding over...

    Thanks for that

  10. #10
    Registered User
    Join Date
    04-02-2016
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2016
    Posts
    18

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Hi Jindon,

    I've tried adding in everything to get all of my information feeding over, but unfortunatley it seems to be missing 30-40 lines and coming up with a "Runtime 1004" error and highlighting this line in the code:

    Set rng = .Offset(1).Resize(.Rows.Count - 1).SpecialCells(12).EntireRow

    I'm not sure why it's missing out the lines that it is. Any ideas??
    Also, at the end (after the error), the lines that are missed seem like they're hidden, but I have to clear the contents of the cells which makes them visible (except the first line). Not sure if this is something to do with the filter. Is there a way to remove the filter once it hits an error or is finished and stop any missed lines from being hidden??
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Copying entire rows to a different sheet based on multiple conidtions

    Change to
    Please Login or Register  to view this content.

+ 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. Replies: 3
    Last Post: 07-18-2015, 02:06 PM
  2. delete entire rows based on cell value in multiple sheets
    By forquaidian in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2014, 05:31 AM
  3. How to transfer multiple entire rows to a new sheet?
    By Fred45 in forum Excel General
    Replies: 1
    Last Post: 11-19-2014, 10:13 AM
  4. Copy entire ROWS from one sheet to another based on cell CONTAINS criteria
    By ihatepivottables in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-16-2014, 09:32 AM
  5. Copying entire rows to other sheet when givin values are true.
    By firemedictj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2013, 07:40 AM
  6. Copying rows in one sheet to another sheet based on defined criteria
    By arvin_tx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2012, 10:49 AM
  7. Copying an entire row or Rows based on column criteria
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-27-2005, 07:06 PM

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