I am trying to get this code to delete any row that contains a cell that contains the word Total in a bolded font. There might be numbers or letters before the "Total" ex. 1223545862 Total, but the word Total is always bolded in the rows I want to remove. This code runs and does not flag any errors but for some reason it does not delete the rows. Anyone have any thoughts on how to fix it?
Sub Find_Delete_Total()
Dim Total_Row As Long
Dim X As Long
Dim delRow As Range
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Worksheets
With Application.FindFormat.Font
.FontStyle = "Bold"
.Subscript = False
.TintAndShade = 0
End With
With Sht
For X = 1 To 10000
Set delRow = .Cells.Find(What:="Total", _
After:=.Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False, _
SearchFormat:=True)
If Not delRow Is Nothing Then
delRow.EntireRow.Delete Shift:=xlUp
End If
Next X
End With
Next Sht
End Sub
Bookmarks