Hi,
I have a large spreadsheet with value from column a through F.I would like to write a code where if column A has a value 4/1/2022 or 4/30/22 VBA code to delete entire row.. There are over 200K rows and the number increases every month
I tried below code however keep receiving error message. I would appreciate if anyone can help me with the below code.
I have a large spreadsheet with value from column a through F.I would like to write a code where if column A has a value 4/1/2022 or 4/30/22 VBA code to delete entire row.. There are over 200K rows and the number increases every month
I tried below code however keep receiving error message. I would appreciate if anyone can help me with the below code.
Sub Delete_Rows_Based_On_Value()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("P&L (2)")
ws.Activate
On Error Resume Next
ws.ShowAllData
On Error GoTo 0
ws.Range("A").AutoFilter Field:=1, Criteria1:="4/1/2022, 4/30/2022"
Application.DisplayAlerts = False
ws.Range("A:F").SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
On Error Resume Next
ws.ShowAllData
On Error GoTo 0
End Sub
Last edited: