Hi Sige,
Try:
'=================>>
Sub HighlightConstantFormulae(Optional aColor As Long = 6)
Dim rng As Range
Dim rng2 As Range
Dim rCell As Range
Dim arr As Variant
Dim sStr As String
Dim i As Long
arr = Array("/", "~*", "+", "-", ">", "<", "=", "^", "[*]", "(")
On Error Resume Next 'In case no formulas!
Set rng = ActiveSheet.UsedRange.SpecialCells(xlFormulas)
On Error GoTo 0
If Not rng Is Nothing Then
For Each rCell In rng.Cells
For i = LBound(arr) To UBound(arr)
sStr = "*" & arr(i) & "[0-9]*"
If rCell.Formula Like sStr Then
If Not rng2 Is Nothing Then
Set rng2 = Union(rng2, rCell)
Else
Set rng2 = rCell
End If
End If
Next i
Next rCell
Else
'No formulas found
End If
rng2.Interior.ColorIndex = aColor
End Sub
'<<=================
Usage:
'=================>>
Sub TestIt()
HighlightConstantFormulae ' To Highlight in colour
'OR uncomment the next line
' HighlightConstantFormulae 0 ' To remove Highlight
End Sub
'<<=================
Change Optional aColor As Long = 6 to a colour of your choice.
---
Regards,
Norman
Sige said:
Norman,
Would it be possible to highlight it in a color? ...
This is too trivial I know ... But how to UNDO the highlighting?
Sige