+ Reply to Thread
Results 1 to 4 of 4

Macro to move row based on cell contents

  1. #1
    Registered User
    Join Date
    12-27-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Macro to move row based on cell contents

    Hi all,

    I have a report to calculate commissions for salespeople. I have raw data and then six sheets, one for each of six salespeople. I'd like to create a macro that will read column B, and based on which salesperson it is, move that entire row to that salesperson's sheet.

    For instance, if on the "data" sheet B2 says "Edwards, Carson", I would like row 2 to get moved to the "Edwards, Carson" sheet row 7
    Then if on the "data" sheet, B9 says "Edwards, Carson" I would like row 9 to get moved to the "Edwards, Carson" sheet row 8 (right below the one before). Similarly, if on the "data" sheet, B21 says "Martin, Jules", I would like row 12 to get moved to the "Martin, Jules" sheet row 7

    With the help of Mike7952, I have the following:

    Please Login or Register  to view this content.
    But this does not work - I think it has to do with line 7.

    Any help is appreciated and let me know if I can provide more details.

    The spreadsheet is attached.

    Jordan
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to move row based on cell contents

    Jordan,
    Not exactly what you are looking for but as option, you can copy entire row in to each name tab based on column B, but it is not going to be auto, but when you run the code, it clears existing data and repopulate with the new in each tab name. Let me know if you want this code.

  3. #3
    Registered User
    Join Date
    12-27-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Macro to move row based on cell contents

    Thanks for the offer. I am trying to fix the code as a learning experience and because I have a feeling it is pretty close.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to move row based on cell contents

    Yes, it can be done using Many "Select case, or ifs statements, but it is going to a long one.

+ 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