+ Reply to Thread
Results 1 to 8 of 8

If change in one column using specific word, then copy row to another tab, repeat.

Hybrid View

  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7

    If change in one column using specific word, then copy row to another tab, repeat.

    I have a worksheet that is now being used for department quality control. There is a comments column ("F") that if a specific word shows up "fail" (xlPart since there may be more comments), I need that row which contains that word (source) to be moved to another spreadsheet (destination). This is a dynamic document, so once that is moved over that row might be deleted from the source tab and a new row added not containing that word. Yet the next row added to the source might have that specific word show in column F and I need that row moved over and placed after the first instance and so on and so forth until the document is complete (a single word signifier which I trap and lock the document).

    This might be simple and I'm over thinking it, but I typically don't use Worksheet_Change or Worksheet_SelectionChange and it's causing me some headaches. Any help would be greatly appreciated. Thank you.

  2. #2
    Registered User
    Join Date
    04-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: If change in one column using specific word, then copy row to another tab, repeat.

    Quote Originally Posted by mastro78 View Post
    I have a worksheet that is now being used for department quality control. There is a comments column ("F") that if a specific word shows up "fail" (xlPart since there may be more comments), I need that row which contains that word (source) to be moved to another spreadsheet (destination). This is a dynamic document, so once that is moved over that row might be deleted from the source tab and a new row added not containing that word. Yet the next row added to the source might have that specific word show in column F and I need that row moved over and placed after the first instance and so on and so forth until the document is complete (a single word signifier which I trap and lock the document).

    This might be simple and I'm over thinking it, but I typically don't use Worksheet_Change or Worksheet_SelectionChange and it's causing me some headaches. Any help would be greatly appreciated. Thank you.
    Any thoughts on this? I'd appreciate anything since I've tried quite a few different things with no luck. Please and thank you!

  3. #3
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: If change in one column using specific word, then copy row to another tab, repeat.

    Hi
    Post a sample data..

    Regards...
    Click *, if my suggestion helps you. Have a good day!!

  4. #4
    Registered User
    Join Date
    04-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: If change in one column using specific word, then copy row to another tab, repeat.

    The idea is that the Source tab is dynamic so what is in row 4 now might not be what is in row 4 hour to hour throughout the day. I just need a way to capture each row where column "F" contains the word(part of word) "Fail" and place it in the Destination tab. Never overwritting, but appending everytime. Thanks for any help.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: If change in one column using specific word, then copy row to another tab, repeat.

    You mean copy from source and put it in destination.

  6. #6
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: If change in one column using specific word, then copy row to another tab, repeat.

    Hi
    Try this code:
    Sub copydata()
    Dim rcnt1 As Long, rcnt2 As Long

    rcnt1 = Sheets("SOURCE").Range("A" & Rows.Count).End(xlUp).Row
    rcnt2 = Sheets("DESTINATION").Range("A" & Rows.Count).End(xlUp).Row

    For i = 2 To rcnt1
    If InStr(1, Sheets("SOURCE").Range("F" & i), "fail") > 0 Then
    rcnt2 = rcnt2 + 1
    Sheets("SOURCE").Rows(i & ":" & i).Copy (Sheets("DESTINATION").Range("A" & rcnt2))
    End If
    Next
    End Sub
    Regards...

  7. #7
    Registered User
    Join Date
    04-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: If change in one column using specific word, then copy row to another tab, repeat.

    Perfect, I can tweak it from there but fantastic. Thank you!

  8. #8
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: If change in one column using specific word, then copy row to another tab, repeat.

    Thanks for your feedback.. Pls click the STAR below the post... Thanks once again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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