I have tried to wrire code to delete rows starting from one row above where txt " Detail L" appears to 9 rows below where "Detail L" , but cannot get the code to work properly
I have attached sample data. The rows to be deleted must be 56 to 65 in this example-see my code and sample data below
Your assistance will be most appreciated
Sub Del_Unwanted()
Finalrow = Cells(65536, 1).End(xlUp).Row
For i = Finalrow To 5 Step -1
If Cells(i, 1).Value = "Detail L" Then
Cells(i, 1).Offset(-1).Resize(10).EntireRow.Delete
End If
Next i
end Sub
I have attached sample data. The rows to be deleted must be 56 to 65 in this example-see my code and sample data below
Your assistance will be most appreciated
Sub Del_Unwanted()
Finalrow = Cells(65536, 1).End(xlUp).Row
For i = Finalrow To 5 Step -1
If Cells(i, 1).Value = "Detail L" Then
Cells(i, 1).Offset(-1).Resize(10).EntireRow.Delete
End If
Next i
end Sub
East1101P.xls | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
55 | 684 | PTS26/02/11 | FrontCounterInvoice | 84103 | 57 | 57 | |||
56 | |||||||||
57 | DetailL | ineAgeing:N | 00Current-37939.93P1 | 7939.93 | |||||
58 | EA | MonFe | b2810:27:48 | 2011Pa | |||||
59 | ======== | ============= | ======================= | ======== | ============== | =========== | |||
60 | |||||||||
61 | Nominal | account | |||||||
62 | -------- | ------------- | |||||||
63 | |||||||||
64 | RefNo | JrnDate | Narrative | Ctl | Transamt. | Ctlbalance | |||
65 | ------ | ------- | --------- | --- | ---------- | ---------- | |||
66 | 685 | PTS26/02/11 | FrontCounterInvoice | 84104 | 508.95 | 508.95 | |||
Sheet1 |