asked on
Sub ReplaceTotal()
Dim rDelete As Range
Dim strSearch As String
Dim iLookAt As Long
Dim bMatchCase As Boolean
Dim ws As Worksheet
strSearch = "Total" 'Value to search for inbetween ""
iLookAt = xlPart 'Change to xlWhole if the entire cell must equal search string
bMatchCase = False 'Change to True if you want search to be case sensitive
Set rDelete = Nothing
Application.ScreenUpdating = False
For Each ws In Worksheets
With ws.UsedRange
Set rFind = .Find(strSearch, LookIn:=xlValues, LookAt:=iLookAt, SearchDirection:=xlPrevious, MatchCase:=bMatchCase)
If Not rFind Is Nothing Then
Do
Set rDelete = rFind
Set rFind = .FindPrevious(rFind)
If rFind.Address = rDelete.Address Then Set rFind = Nothing
rDelete.EntireRow.Delete
Loop While Not rFind Is Nothing
End If
End With
Next
Application.ScreenUpdating = True
End Sub