Don said:
If I understand your request, this will delete rows from where x is found
in H to include the last cell in H with data.
If x at row 13 and 1000 is in cell h20 then those rows will be deleted.
Selections are NOT necessary.
Sub deleterng()
with sheets("sheet3")
fx = .Columns("H").Find("X").Row
lr = .Cells(Rows.Count, "H").End(xlUp).Row
.Rows(fx & ":" & lr).Delete
end with
End Sub
---
If on the sheet in question, then
Sub deleterngA()
fx = Columns("H").Find("X").Row
lr = Cells(Rows.Count, "H").End(xlUp).Row
Rows(fx & ":" & lr).Delete
End Sub
Hi. The another code procedure below is working. The H column has let's
say 300 x's down the column. However there are more data in the G column
that goes to 2000
records. So, I just encluded an If statement for that G column and it
deleted them.
I will play around with your first code procedure. I think it may be a
simpler method if I can get it to work with the G column. Maybe it will
delete the whole records in one sweep.
Here is what is going on.
Column H has the x's in about 300 records. I need to find the first x.
Next, Column G has data upto 2000 records with no x's in column H.
So, I need to find the last row in column G.
The goal is to delete the first row with the first x and all other rows to
the last row in the G column.
A B C D E F G H
CCC C C C C C C SSS
SDF SW FS FFFG S F SSA DS
CDS SD FD SSS A A ASS X
DSS C S CCC F F EFE X
CCC C C C C C C
SDF SW FS FFFG S F SSA
SDF SW FS FFFG S F SSA
SDF SW FS FFFG S F SSA
I need to delete the row with the first X in H column and all other rows to
the last cell in column G.
1 find the first x in column H
2 find the last cell with data in column G
3 delete all records in between.
It can be pretty hard trying to explain the whole picture of what is going
on.
I appreciate your help. Thank You.
Maybe replacing the H in the lr to a G will do it. As in
"lr = .Cells(Rows.Count, "G").End(xlUp).Row"