View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Copy & Paste...if


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

"Saintsman" wrote:

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