I have a code that will delete all rows that do not contain "11328" in column A. However, I have 45 other values that I need to enter, and I cannot figure out how to expand the code. I know very little about vba. If someone show me how to add additional values to my code I will be endlessly appreciative.
-DFB
Here's what I have:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If InStr(Cells(row_index, "A").Value, "11328") = 0 Then
Cells(row_index, "A").EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
End Sub
-DFB
Here's what I have:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If InStr(Cells(row_index, "A").Value, "11328") = 0 Then
Cells(row_index, "A").EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
End Sub