Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Tables - Exclude Rows With Zero Balances | Excel Discussion (Misc queries) | |||
pivot chart exclude rows | Excel Programming | |||
Is there a way to exclude hidden rows/columns when printing a doc | Setting up and Configuration of Excel | |||
Copy rows, but exclude blank rows | Excel Programming | |||
Averages: Exclude Rows with 0 Values | Excel Worksheet Functions |