Sub SpecialCells()
Dim myWorksheet As Worksheet
Dim rgSpecial As Range
Dim rgCell As Range
On Error Resume Next
Set myWorksheet = ThisWorkbook.Worksheets("Sheet1")
Set rgSpecial = myWorksheet.Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
If Not rgSpecial Is Nothing Then
rgSpecial.Interior.Color = vbRed
Else
Debug.Print myWorksheet.Name & " is an error-free worksheet."
End If
Set rgSpecial = Nothing
Set rgCell = Nothing
Set myWorksheet = Nothing
End Sub
|