billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Not sure what I am doing wrong. Any assistance or suggestions would be great..
Thank You
Trying to copy to another worksheet if meets two criteria. Code I am using is;
Application.ScreenUpdating = False
lr = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For w = 2 To lr
If Worksheets("Sheet1").Cells(w, 3).Value = "Green" And Cells(w, 5).Value = "No" Then
Worksheets("Sheet1").Rows(w).Copy
ThisWorkbook.Sheets.Add(after:=ThisWorkbook.Sheets(Sheets.Count)).Name = "Test"
lr2 = Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Test").Cells(lr2 + 1, 1).PasteSpecial
End If
Next w
Application.ScreenUpdating = True
End Sub
Thank You
Trying to copy to another worksheet if meets two criteria. Code I am using is;
Application.ScreenUpdating = False
lr = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For w = 2 To lr
If Worksheets("Sheet1").Cells(w, 3).Value = "Green" And Cells(w, 5).Value = "No" Then
Worksheets("Sheet1").Rows(w).Copy
ThisWorkbook.Sheets.Add(after:=ThisWorkbook.Sheets(Sheets.Count)).Name = "Test"
lr2 = Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Test").Cells(lr2 + 1, 1).PasteSpecial
End If
Next w
Application.ScreenUpdating = True
End Sub