imimin
Active Member
- Joined
- May 9, 2006
- Messages
- 404
I need to create a macro in Excel that will search every row of a sheet for 3 or more semicolons (";"). Each semicolon will be preceded and proceeded by text. If it finds a row with 3 or more semicolons listed it should delete that row. What I have so far is the following (works fine finding one semicolon, can't seem to figure out syntax for 3 or more):
Thank you!
Code:
Sub DeleteRowsContaining()
Dim rng As Range
Dim what As String
what = ";"
Do
Set rng = ActiveSheet.UsedRange.Find(what)
If rng Is Nothing Then
Exit Do
Else
Rows(rng.Row).Delete
End If
Loop
End Sub
Thank you!