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


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.
 
Ad

Advertisements

D

Don Guillett Excel MVP

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
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top