Copy Paste Rows To Another Sheet Based On Column Criteria

  • Hi,


    Need your help with this one!!!


    I have a file that has two sheets, I have some formulas in the first sheet named "Data",What i would like to have is, If column G in the sheet Data is "Closed", then i want that particular row to be cut from the sheet " Data" and pated in to the Sheet "Done".Is this possible.... Please Help!!!!

  • Re: Copy Rows From One Sheet And Paste It In Another Sheet Based On A Column Criteria


    Just select the values in column G of the data sheet(the column with the "Closed" values) and run the code..
    Sub copyrows()
    Dim r As Integer
    Dim cell As Range
    r = 2
    For Each cell In Selection
    If cell.Value = "Closed" Then
    cell.EntireRow.Copy Sheets("done").Cells(r, 1)
    r = r + 1
    End If
    Next cell
    End Sub

  • Re: Copy Rows From One Sheet And Paste It In Another Sheet Based On A Column Criteria


    Thanks for the help...


    But i would also like the data copied to be deleted from the data sheet.

    Regards,
    Salim Thaj

  • Re: Copy Paste Rows To Another Sheet Based On Column Criteria


    Try this one after selecting the values..
    Sub copyrows()
    Dim r As Integer
    Dim i as integer
    r = 2
    For i = Selection.Rows.Count + 1 To 1 Step -1
    If Range("G" & i).Value = "Closed" Then
    Range("G" & i).EntireRow.Copy Sheets("done").Cells(r, 1)
    Range("G" & i).EntireRow.Delete
    r = r + 1
    End If
    Next
    End Sub

  • Re: Copy Paste Rows To Another Sheet Based On Column Criteria


    Hi mtv20,


    i am really sorry that i am bothering you too much....


    The Code is only working for the first row and the data in the second sheet gets overwritten.. I want the lines to add on to the second sheet...

    Regards,
    Salim Thaj

  • Re: Copy Paste Rows To Another Sheet Based On Column Criteria


    I tried it with the sheet that you sent and it works..Maybe I got the idea wrong..You select the cells in the first sheet starting from "G2" and run it in one go..It appends the second sheet starting from the second row then 3rd row etc..

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!