I have this code, which I want to loop through all sheets and delete entire rows based on the value "completed" located anywhere in the sheet...This runs but only on the active sheet, I cant figure a good way to have it loop through every sheet till done...any help is greatly appreciated! ty
Private Sub TestDeleteRows()
Dim rFind As Range
Dim rDelete As Range
Dim strSearch As String
Dim sFirstAddress As String
strSearch = "Completed"
Set rDelete = Nothing
Application.ScreenUpdating = False
With Sheet1.Columns("A:AO")
Set rFind = .Find(strSearch,
LookIn:=xlValues, LookAt:=xlPart, SearchDirection:=xlNext, MatchCase:=False)
If Not rFind Is Nothing Then
sFirstAddress = rFind.Address
Do
If rDelete Is Nothing Then
Set rDelete = rFind
Else
Set rDelete = Application.Union(rDelete, rFind)
End If
Set rFind = .FindNext(rFind)
Loop While Not rFind Is Nothing And rFind.Address <> sFirstAddress
rDelete.EntireRow.Delete
End If
End With
Application.ScreenUpdating = False
End Sub