D
DaveCrowley
Hi Guys,
I currently have the pleasure of having to get up to speed with some
undocumented spreadsheets. To aid me, I'd like to visually identify all
formulas within these spreadsheets. I have been able to do this manually
successfully using "Conditional Formatting..." and a user defined
function (see below).
This feature worked a treat but having it switched on all the time
appeared to degrade performance. Therefore I tried to create two
macros. One macro to enable "Conditional formatting..." for all cells
in the current sheet, and a second macro to disable it. That way I can
switch it on and off as required. The macro to disable/delete the
"Conditional formatting" works a treat but the macro to enable it does
not. Stepping through the code (see below), it executes the first three
statements in the macro, then exits the routine.
Am I doing something silly or have I unearthed a bug? Any advise/help
would be highly appreciated.
Cheers, Dave.
Function IsFormula(Check_Cell As Range)
IsFormula = Check_Cell.HasFormula
End Function
Sub Show_Formulas_in_Current_Sheet()
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IsFormula(A1)"
With Selection.FormatConditions(1).Borders(xlLeft)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
With Selection.FormatConditions(1).Borders(xlRight)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
With Selection.FormatConditions(1).Borders(xlTop)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
With Selection.FormatConditions(1).Borders(xlBottom)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
End Sub
I currently have the pleasure of having to get up to speed with some
undocumented spreadsheets. To aid me, I'd like to visually identify all
formulas within these spreadsheets. I have been able to do this manually
successfully using "Conditional Formatting..." and a user defined
function (see below).
This feature worked a treat but having it switched on all the time
appeared to degrade performance. Therefore I tried to create two
macros. One macro to enable "Conditional formatting..." for all cells
in the current sheet, and a second macro to disable it. That way I can
switch it on and off as required. The macro to disable/delete the
"Conditional formatting" works a treat but the macro to enable it does
not. Stepping through the code (see below), it executes the first three
statements in the macro, then exits the routine.
Am I doing something silly or have I unearthed a bug? Any advise/help
would be highly appreciated.
Cheers, Dave.
Function IsFormula(Check_Cell As Range)
IsFormula = Check_Cell.HasFormula
End Function
Sub Show_Formulas_in_Current_Sheet()
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IsFormula(A1)"
With Selection.FormatConditions(1).Borders(xlLeft)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
With Selection.FormatConditions(1).Borders(xlRight)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
With Selection.FormatConditions(1).Borders(xlTop)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
With Selection.FormatConditions(1).Borders(xlBottom)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = 3
End With
End Sub