Delete_Unwanted_Rows

Delete rows in a different way
I used to delete rows by looping through those rows and use Range().Delete xlshiftUp for rows need to be deleted.
But that process takes too long if we have too many rows to delete.
As an alternative method, we can use 1 delete command after searching for those rows.
This is the function to do that, it is not complete, and not to be used out-of-the-box, it needs some tweaks first.

CodeFunctionName
What is this?

Public

Tested

Imported
Sub Delete_Unwanted_Rows()
' rngDealLoad_Key_Found. is the range object that has rows we need to loop through.
Dim rngDelete As Range
Set rngDelete = Nothing
On Error Resume Next
Set rngDelete = rngDealLoad_Key_Found.SpecialCells(xlCellTypeFormulas, 23)
If Not rngDelete Is Nothing Then
rngDelete.EntireRow.Delete shift:=xlUp
End If
On Error GoTo 0
End Sub

Views 1,169

Downloads 390

CodeID
DB ID