Hi, learning_vba,
what Andy used is the codename for the sheet, not the one on the worksheet tab.
If you donīt know the name you could refer to ActiveSheet for the sheet the code is run on or loop through the worksheets in the workbook and rely on them without having to know the names:
Sub HighlightFormulaswithSheetRefsActSheet()
Dim Rng As Range
With Application
.ScreenUpdating = False
.Calculation = xlManual
End With
On Error Resume Next
For Each Rng In ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
If InStr(1, Rng.Formula, "Sheet", vbTextCompare) > 0 Then
Rng.Interior.ColorIndex = 6
End If
Next Rng
With Application
.Calculation = xlAutomatic
.ScreenUpdating = False
End With
On Error GoTo 0
End Sub
Sub HighlightFormulaswithSheetRefsAllWks()
Dim Rng As Range
Dim wks As Worksheet
With Application
.ScreenUpdating = False
.Calculation = xlManual
End With
On Error Resume Next
For Each wks In Worksheets
For Each Rng In wks.UsedRange.SpecialCells(xlCellTypeFormulas)
If InStr(1, Rng.Formula, "Sheet", vbTextCompare) > 0 Then
Rng.Interior.ColorIndex = 6
End If
Next Rng
Next wks
With Application
.Calculation = xlAutomatic
.ScreenUpdating = False
End With
On Error GoTo 0
End Sub
Cioa,
Holger
Bookmarks