Sub HighlightCellsReferenced()
Dim rowCnt As Integer
Dim i As Integer, j As Integer, strleng As Integer
Dim strTxt As String, strFml As String
Dim columnStr, cellsAddress As String
Dim xRg As Range, yRg As Range
On Error Resume Next
Set xRg = Application.InputBox(Prompt:="Please select formula cell(s)...", _
Title:="Kutools For Excel", Type:=8)
strTxt = ""
Application.ScreenUpdating = False
For Each yRg In xRg
If yRg.Value <> "" Then
strFml = yRg.Formula + " "
strFml = Replace(strFml, "(", " ")
strFml = Replace(strFml, ")", " ")
strFml = Replace(strFml, "-", " ")
strFml = Replace(strFml, "+", " ")
strFml = Replace(strFml, "*", " ")
strFml = Replace(strFml, "/", " ")
strFml = Replace(strFml, "=", " ")
strFml = Replace(strFml, ",", " ")
strFml = Replace(strFml, ":", " ")
For j = 1 To Len(strFml)
If Mid(strFml, j, 1) <> " " Then
cellsAddress = cellsAddress + Mid(strFml, j, 1)
Else
On Error Resume Next
Range(cellsAddress).Interior.ColorIndex = 3
cellsAddress = ""
End If
Next
End If
Next yRg
Application.ScreenUpdating = True
End Sub