Crudely put: If there is an exclamation mark, I assume that it is a sheet reference.
"Close enough for government work"
Code: Select all
Function blnStainfromInput(rng As Range, lngColorIndex As Long) As Boolean
''' Stain all cells CONTAINING A LINK to a background color
''' RANGE Of cells to be stained
''' LONG Color Index = 1:56 where 2=White; -4142=xlNone
On Error GoTo Failed
Dim rngCell As Range
For Each rngCell In rng
''' rngCell.Select
If rngCell.HasFormula Then
If InStr(1, rngCell.Formula, "!") > 0 Then
rngCell.Interior.ColorIndex = lngColorIndex
blnStainfromInput = True
Else
End If
Else
End If
Next rngCell
Failed:
'Sub TESTblnStainfromInput()
' Call blnStainfromInput(ActiveSheet.UsedRange, 5)
'End Sub
End Function