delete rows which have a one in them
dennis
thanks for trying to help me out. when i use your code after i write
("h" + cstr(my row))
it says compile error: expected: list separator or )
i eventually got the code to work with
for i = 1 to 67000
if cells(i, 8).value = 1 then
cells(i, 1).entirerow.delete
end if
next i
but i don't see why
finalrow = cells(rows.count, 1).end(xlup).row
won't work, seeing as i got it from mrecxel himself, bill jelen
"Dennis Tucker" wrote:
Try this.
Sub Macro1()
' count down through the rows(from bottom to the top)
For MyRow = Worksheets("Sheet1").UsedRange.Rows.Count To 2 Step -1
' check column H for a "1"
If Worksheets("Sheet1").Range("H" + CStr(MyRow)).Value = "1" Then
' select the row
Rows(CStr(MyRow) + ":" + CStr(MyRow)).Select
' delete the row & shift data up
Selection.Delete Shift:=xlUp
End If
Next MyRow
End Sub
"kyle" wrote in message
...
i've got this code built that will delete a row if there is a one in
column h
but it's not working
sub delete()
finalrow = celss(rows.count, 1).end(xlup).row
for i = finalrow to 2 step -1
if cells(i, 8) = 1 then
cells(i, 1).entirerow.delete
endif
next i
end sub
it doesn't work, what do you think is wrong?
.
|