
Use a user-defined function to detect cells
with formulas
This example requires you to be familiar with the VBA Editor. Here
we want to mark all cells in a specific range that contain a formula.
First, you need to write a user-defined function:
1. Press <Alt+F11> to open up the VBA window.
2. On the Insert menu, click Module and enter the following
function:
Function HF(rng)As Boolean
HF = rng.HasFormula
'returns TRUE if rng contains
'a formula
End Function
(The lines above that begin with an apostrophe indicate the
information that follows is a comment.)
3. Press <Alt+Q> to return to the Excel worksheet.
Now you can use this user-defined function in conditional ...