• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy rows to another worksheet based on a condition

Hi,

In sheet1 I have values from B5 to P1000....

If the value in Column L is Zero then it has to be copied to Sheet 2 from COLUMN B to COLUMN J

Attached the sample sheet
 

Attachments

  • Sample.xlsx
    10 KB · Views: 4
This code copies from the start. So ensure Sheet2 is clean when running.

Code:
Sub copier()

Worksheets("Sheet1").Select
Range("L6").Select
Do Until IsEmpty(ActiveCell)
    If ActiveCell = 0 Then
        Range("B" & ActiveCell.Row & ":J" & ActiveCell.Row).Copy
        Worksheets("Sheet2").Select
        Range("B" & Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).Row).Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        Worksheets("Sheet1").Select
        ActiveCell.Offset(1, 0).Select
    Else
        ActiveCell.Offset(1, 0).Select
    End If
Loop

MsgBox "Macro Completed", vbInformation, ""

End Sub
 
Back
Top