View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron[_6_] Ron[_6_] is offline
external usenet poster
 
Posts: 48
Default Find Cell When Interior.ColorIndex =3

Hello all,
Due to change in scope of my project I'm trying edit this code to meet
the requirements. Find a cell when the interior ColorIndex = 3
(Red). The cell could possibly be blank or it could hold data. If
the code finds a cell with the interior formatted to = 3 (Red) then
"MsgBox "Please correct any cells highlighted RED and click on the
Validate Button." If the code does not find any cells with interior
formating equaling 3 (Red) then MsgBox("Data validated, good job!" If
the sheet is to be printed, clicking on the Print Setup button
prepares the file for printing.".

My first attempt was looking for a cell with Red font but, realized
that I had some blank cells that I need to flag so, the Red font
approach did not work well with blank or empty cells.
Thank you all for your assistance,

Sub FindRedFont()
Dim UserResponse As Variant
On Error GoTo NoRedFonts
Application.FindFormat.Interior.ColorIndex = 3
Range("I12:AI10000").Find("*", After:=Range("AI10000"), _
SearchFormat:=True, SearchOrder:=xlByColumns).Select

MsgBox "Please correct any cells highlighted RED and click on the
Validate Button" & vbNewLine & "" & vbNewLine & _
"", , "Jrnl 1 Corrections"
Exit Sub

NoRedFonts:
UserResponse = MsgBox("Data validated, good job!" _
& vbNewLine & vbNewLine & _
"If the sheet is to be printed, " & _
"clicking on the Print Setup button " & _
"prepares the file for printing.", _
vbExclamation + vbOKCancel, "TEST")
If UserResponse = vbCancel Then
Exit Sub 'Or other required code
End If

End Sub