+ Reply to Thread
Results 1 to 3 of 3

Macro to move entire row if cell contains a specific word and moved to sheet 2

  1. #1
    Registered User
    Join Date
    08-10-2011
    Location
    Harlow, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Smile Macro to move entire row if cell contains a specific word and moved to sheet 2

    I have a workbook with two worksheets in it. The first "Active" and the second "Archive". In "Active", I have rows of information starting at row 2 (row 1 is my header), going to 1000. What I'd like to have happen is when I put a "Allocated" in column J, it moves the entire row to the "Archive" worksheet, and removes it from the "Active" worksheet. Then if I remove the "Allocated" from the "Archive" worksheet, it moves it back to the bottom of the list on the “Active”. I know this can be done, I just don’t know how and how to implement it.

    Your help would be appreciated.

    Astarte
    Attached Files Attached Files
    Last edited by Astarte; 08-12-2011 at 09:38 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro to move entire row if cell contains a specific word and moved to sheet 2

    Astarte,

    Welcome to the forum. Attached is a modified version of your workbook. I had to change a few things to get it all to work:
    • Moved the validation list items into a new (hidden) worksheet named 'Lists'
    • Set up named ranges for each of the validation lists so that they could be used in the other two worksheets
      • Note: The named range formula isn't necessary, I put it in there so you can add/remove items to the list and it will update automatically
    • Removed the conditional formatting in the 'Active' worksheet
      • When items were cut/pasted between sheets, the conditional formatting got messed up and was causing "Overlap" errors.
      • In the code, I included a VBA version of conditional formatting so that the sheet would still the desired formatting effect. This prevented the "Overlap" errors.
    Here's the code that I came up with (note, this is in the ThisWorkbook event module, not a Sheet event module):
    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-10-2011
    Location
    Harlow, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Macro to move entire row if cell contains a specific word and moved to sheet 2

    Hi Tigeravatar,

    Thank you so much it is really appreaciated.

    Kind regards,

    Astarte

+ 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