Copy rows from Sheet1 to Sheet2 when Column B values equal "X" andColumn C values > 100

  • Thread starter Thread starter u473
  • Start date Start date
U

u473

How do I copy rows (Columns A,B,D only, values only) from Sheet1 to
Sheet2, same workbook.
when Column B values equal "X" and Column C values > 100.
Help appreciated
J.P.
 
How do I copy rows (Columns A,B,D only, values only) from Sheet1 to
Sheet2, same workbook.
 when Column B values equal "X" and Column C values > 100.
Help appreciated
J.P.

Sub SAS_CopyValuesIF()
Dim r As Double
Dim i As Long
r = 16 'start row on destination sheet
For i = 1 To Cells(Rows.Count, "b").End(xlUp).Row
If UCase(Cells(i, 2)) = "X" And Cells(i, 3) > 100 Then
Sheets("sheet4").Cells(r, 1).Value = Cells(i, 1).Value
Sheets("sheet4").Cells(r, 2).Value = Cells(i, 2).Value
Sheets("sheet4").Cells(r, 3).Value = Cells(i, 4).Value
r = r + 1
End If
Next i
End Sub
 
Back
Top