Hello,
I have large reports over 20k rows that I am trying to build a code for. The main part I am stuck on is that i need to delete any row that contains the string "The address is valid and deliverable according to official postal agencies." in column J. Both the codes i am posting do work but hang for a while (understandably) so i am just checking if there is something I can do to speed the process up.
and i also have
As I said, I am just beginning to build the code but deleting these rows drops the file 10 to 12k rows so i figure this part is best to tackle first. So if there is a best practice solution that is better, I am totally open to it. I figure this is a piece of code i will use frequently on big files so better to start doing it properly. Thanks for the help!
I have large reports over 20k rows that I am trying to build a code for. The main part I am stuck on is that i need to delete any row that contains the string "The address is valid and deliverable according to official postal agencies." in column J. Both the codes i am posting do work but hang for a while (understandably) so i am just checking if there is something I can do to speed the process up.
VBA Code:
With ActiveSheet
.AutoFilterMode = False
With Range("j1", Range("j" & Rows.Count).End(xlUp))
.AutoFilter 1, "*The address is valid and deliverable according to official postal agencies.*"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
and i also have
Code:
With ActiveSheet.UsedRange
.AutoFilter Field:=10, Criteria1:="=*The address is valid and deliverable according to official postal agencies.*"
.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilter
End With
As I said, I am just beginning to build the code but deleting these rows drops the file 10 to 12k rows so i figure this part is best to tackle first. So if there is a best practice solution that is better, I am totally open to it. I figure this is a piece of code i will use frequently on big files so better to start doing it properly. Thanks for the help!