I want to find all the cells with text “Not Found”, and make their font Red.
Any advise on how to do so?
String NotFound = “Not Found”
My program will call the subprocedure Find_NotFound
The Looping part Im not very sure, as it should Find until all “Not Found” are Red.
I got an Error on the “Loop While” part
<code>Sub Find_NotFound(NotFound As String)
'============================================
Application.ScreenUpdating = False
Dim Find_NotFound As Range
Range("A1").Select
Set Find_NotFound = Cells.Find(What:=NotFound, After:=ActiveCell, LookIn:=xlFormulas2, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
'Start from A1 Cell, start Finding
'===================================================================
'If found "Not Found" word
If Not Find_NotFound Is Nothing Then
Find_NotFound.Activate
Do
With Selection.Font
.Color = vbRed
End With
Cells.FindNext(After:=ActiveCell).Activate
Loop While Cells.Selection.Font.Color <> vbRed
End If
Application.ScreenUpdating = True End Sub
</code>
<code>Sub Find_NotFound(NotFound As String)
'============================================
Application.ScreenUpdating = False
Dim Find_NotFound As Range
Range("A1").Select
Set Find_NotFound = Cells.Find(What:=NotFound, After:=ActiveCell, LookIn:=xlFormulas2, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
'Start from A1 Cell, start Finding
'===================================================================
'If found "Not Found" word
If Not Find_NotFound Is Nothing Then
Find_NotFound.Activate
Do
With Selection.Font
.Color = vbRed
End With
Cells.FindNext(After:=ActiveCell).Activate
Loop While Cells.Selection.Font.Color <> vbRed
End If
Application.ScreenUpdating = True End Sub
</code>
Sub Find_NotFound(NotFound As String)
'============================================
Application.ScreenUpdating = False
Dim Find_NotFound As Range
Range("A1").Select
Set Find_NotFound = Cells.Find(What:=NotFound, After:=ActiveCell, LookIn:=xlFormulas2, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
'Start from A1 Cell, start Finding
'===================================================================
'If found "Not Found" word
If Not Find_NotFound Is Nothing Then
Find_NotFound.Activate
Do
With Selection.Font
.Color = vbRed
End With
Cells.FindNext(After:=ActiveCell).Activate
Loop While Cells.Selection.Font.Color <> vbRed
End If
Application.ScreenUpdating = True End Sub
Kind Regards