Hi there,
Dim LastRow&, FilterRange As Range
With Sheets("KCC - OD")
.AutoFilterMode = False
LastRow = .Cells.Find("*", after:=.Range("B1"), SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
Set FilterRange = .Range("AB1:AB" & LastRow)
FilterRange.AutoFilter Field:=1, Criteria1:="=2"
On Error Resume Next
FilterRange.SpecialCells(12).EntireRow.Delete
Err.Clear
.AutoFilterMode = False
End With
Set FilterRange = Nothing
First of all let me tell you that I am not an expert in Excel or making macros. I get the knowledge from the members of this forum who are ready to help.
I am using the macro given above to delete rows in a sheet named KCC - OD, when the value in column AB is 2. It was working fine and fast. But nowadays it is **** slow and I don't know why. The sheet has around 2000 rows and 30 columns.
Can anyone help me to make it a bit more fast.
Thank you.
Dim LastRow&, FilterRange As Range
With Sheets("KCC - OD")
.AutoFilterMode = False
LastRow = .Cells.Find("*", after:=.Range("B1"), SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
Set FilterRange = .Range("AB1:AB" & LastRow)
FilterRange.AutoFilter Field:=1, Criteria1:="=2"
On Error Resume Next
FilterRange.SpecialCells(12).EntireRow.Delete
Err.Clear
.AutoFilterMode = False
End With
Set FilterRange = Nothing
First of all let me tell you that I am not an expert in Excel or making macros. I get the knowledge from the members of this forum who are ready to help.
I am using the macro given above to delete rows in a sheet named KCC - OD, when the value in column AB is 2. It was working fine and fast. But nowadays it is **** slow and I don't know why. The sheet has around 2000 rows and 30 columns.
Can anyone help me to make it a bit more fast.
Thank you.