paste in different range on condition

  • Hello,
    In the file in the attachement, names are copied to different sheets on a condition that is in column 2.
    (Macro Searchonstring)
    Example all rows with FS in column 2 are copied to sheet FS, with CF in column 2 are copied to Sheet CF,...
    But I have a 3th column that can contain 2 values: OK or NOK
    What I want is that rows with FS in column 2 are copied to sheet FS, this works already, but then those with OK in column 3 must be pasted in the Range A1:A10, those with NOK must be pasted in the range A11:A20
    Thanks for helping
    aisietie

  • Re: paste in different range on condition


    why not try this macro (only one macro not three macros-if you want you can put one form button and assign this macro to that button)


    but make sure each set of F etc and ok or nok are less than TEN rows





    Code
    Sub Undo()
    Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
    If ws.Name = "Data" Then GoTo nextws
    ws.Cells.Clear
    nextws:
    Next ws
    End Sub

Participate now!

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