![]() |
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 |
Exclude rows with result 1
you are missing the period in front of cells on this line
from If Cells(i, "A").Value = 0 Then to If .Cells(i, "A").Value = 0 Then "Robert" wrote: 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 |
All times are GMT +1. The time now is 09:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com