Sir,
I have done the following macro code to delete rows when conditions are met in a particular column.
The macro code works fine for small data. But it takes long time for big data.
Is there any other macro code to speed up the execution time.
I have attached sample workbook for your reference. Kindly help.
Sub Delete_rows()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim sh1 As Worksheet
Dim lastrow As Long
Dim i As Long
Set sh1 = ThisWorkbook.Worksheets("Delete")
lastrow = sh1.Cells(Rows.Count, "A").End(xlUp).Row
For i = lastrow To 2 Step -1
If sh1.Cells(i, "B").Value = "STATIONERY" Or sh1.Cells(i, "B").Value = "VEGETABLES" Then
sh1.Cells(i, "A").EntireRow.Delete
Else
End If
Next i
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Bookmarks