Hey guys,
Can someone help make the below better?
If UCase(Cells(ii, 3).Value) = UCase(" Pre-start") Or UCase(Cells(ii, 3).Value) = UCase(" pre-start") Or UCase(Cells(ii, 3).Value) = UCase("Pre-start") Or UCase(Cells(ii, 3).Value) = Empty Then
I really hate this line of code. I would love it if I was able to feed a list of entries when I begin the code, rather then type each of them out like this.
Anyone got an neat fixes?
Sub Removeothers()
'Input a name that you want to find.
'Will search down a column and delete every row that does not have, the searched name within the column.
'
'Application.ScreenUpdating = False
Dim X1 As Range
Dim X2 As Range
Dim cell As Range
Set X1 = Range("C4")
X1.Select
Selection.End(xlDown).Select
Set X2 = Selection
i = X2.Row
For ii = 4 To i
If UCase(Cells(ii, 3).Value) = UCase(" Pre-start") Or UCase(Cells(ii, 3).Value) = UCase("*pre-start") Or UCase(Cells(ii, 3).Value) = UCase("Pre-start") Or UCase(Cells(ii, 3).Value) = Empty Then
Else
Cells(ii, 3).EntireRow.Select
Cells(ii, 3).EntireRow.Delete Shift:=xlUp
ii = ii - 1
End If
Next
End Sub
Bookmarks