View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert[_30_] Robert[_30_] is offline
external usenet poster
 
Posts: 44
Default Exclude rows with result 1

Hi All,

The below statement should only copy the rows that have a "0" in
column A but for some reason all values (0 and 1) are copied.
Can someone tell me how to adjust this statement so that only the rows
with "0" are subtracted?

Thanks a lot

Regards,
Robert

'Exclude all Swaps
Dim iLastRow As Long, iNextRow As Long
Dim i As Long
With Worksheets("Positions")
iLastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "A").Value = 0 Then
iNextRow = iNextRow + 1
.Cells(i, "B").Resize(, 21).Copy _
Worksheets("Cut-Out").Cells(iNextRow, "A")
End If
Next i

End With