Hi All:
I'm trying to code a macro to delete irrelevant data and the for loop I'm using takes considerable time; I'm wondering if selecting all the irrelevant rows and then deleting would be faster than deleting each row as its found.
Currently the code I have is:
For x = LR To 2 Step -1
If Range("B" & x).Value = "" Then
Rows(x).Select
Selection.Delete shift:=xlUp
End If
Next x
(LR is a line count variable)
This code works but is slow as the sheet usually has in excess of 10,000 rows. I'm hoping there's syntax I could use in the loop to keep adding to my selected rows; then once the for loop is done have one line that deletes the entire selection. Any thoughts?
Many thanks.
I'm trying to code a macro to delete irrelevant data and the for loop I'm using takes considerable time; I'm wondering if selecting all the irrelevant rows and then deleting would be faster than deleting each row as its found.
Currently the code I have is:
For x = LR To 2 Step -1
If Range("B" & x).Value = "" Then
Rows(x).Select
Selection.Delete shift:=xlUp
End If
Next x
(LR is a line count variable)
This code works but is slow as the sheet usually has in excess of 10,000 rows. I'm hoping there's syntax I could use in the loop to keep adding to my selected rows; then once the for loop is done have one line that deletes the entire selection. Any thoughts?
Many thanks.