J
JJ
What code do I have to use to read through a column of cells and if a cell
has a certain value, it will delete the entire row. I have this code, but it
keeps moving down a space after it deletes the row. For instance, I want to
delete an entire row if the cell value is "2", but if there are numerous "2"s
in a row, it always skips everyother one. Ex: 1,1,2,2,2,2 the result will
show remaining cells 1,1,2,2. Here is what I have so far:
Sub (rowdelete)
For Each rw In Worksheets("sheet1").Cells(1, 1).CurrentRegion.Rows
this = rw.Cells(1, 1).Value
If this = last Then rw.delete
last = this
Next
End Sub
has a certain value, it will delete the entire row. I have this code, but it
keeps moving down a space after it deletes the row. For instance, I want to
delete an entire row if the cell value is "2", but if there are numerous "2"s
in a row, it always skips everyother one. Ex: 1,1,2,2,2,2 the result will
show remaining cells 1,1,2,2. Here is what I have so far:
Sub (rowdelete)
For Each rw In Worksheets("sheet1").Cells(1, 1).CurrentRegion.Rows
this = rw.Cells(1, 1).Value
If this = last Then rw.delete
last = this
Next
End Sub