Copy & Paste...if

S

Saintsman

I want to copy values from ColB (Range2) but paste only if values in ColA
(Range1) = a specified value eg yes. I work with named ranges
ColA ColB result (different sheet)
yes 10 10
yes 12 12
no 5 30
no 10
yes 30
no 12
Any help as always gratefully received
 
J

Joel

Sub test()

RowCount = 1
NewRowCount = 1
With ActiveSheet
Do While .Range("A" & RowCount) <> ""
If .Range("A" & RowCount) = "Yes" Then
.Range("B" & RowCount).Copy _
Destination:=Sheets("NewSheet").Range("A" & NewRowCount)
NewRowCount = NewRowCount + 1
End If

RowCount = RowCount + 1
Loop
End With

End Sub
 

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