Hi, I'm knew to this and would appreciate any help provided. I read somewhere that there is a limit to the number of terms that one macro could handle. I need a VBA script to delete multiple rows in column “A” based on if the cell has (ANY) reference of over 150 terms.
For example, if I want to delete the row that has the word “Ball” in it, three of the below five entries would be deleted.
Ball game
Sports Stadium
Softball game
Football game
Sports Fan
All that would remain is “Sports Stadium” and “Sports Fan”. I tried this script but got error messages
Sub Removal()
Dim i As Long, searchString As String
For i = Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
' if a row is marked for deletion, delete it and continue.
If Left(Range("A" & i), 1) = "0" Then
Rows(i).Delete
' skip to next row
GoTo NextRow
End If
searchString = LCase(Range("A" & i))
If (InStr(1, searchString, "ball") > 0) Or _
(InStr(1, searchString, "number") > 0) Or _
(InStr(1, searchString, "minimum") > 0) Then
Rows(i).Delete
End If
Can someone help with this? What am I doing wrong?
For example, if I want to delete the row that has the word “Ball” in it, three of the below five entries would be deleted.
Ball game
Sports Stadium
Softball game
Football game
Sports Fan
All that would remain is “Sports Stadium” and “Sports Fan”. I tried this script but got error messages
Sub Removal()
Dim i As Long, searchString As String
For i = Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
' if a row is marked for deletion, delete it and continue.
If Left(Range("A" & i), 1) = "0" Then
Rows(i).Delete
' skip to next row
GoTo NextRow
End If
searchString = LCase(Range("A" & i))
If (InStr(1, searchString, "ball") > 0) Or _
(InStr(1, searchString, "number") > 0) Or _
(InStr(1, searchString, "minimum") > 0) Then
Rows(i).Delete
End If
Can someone help with this? What am I doing wrong?