
Use a user-defined function to detect cells
with numeric values
Continuing with the previous tip, let’s now mark all cells in a range
that contain valid numeric values. 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 ISNUM(rng) As Boolean
If rng.Value <> "" Then
ISNUM = IsNumeric(rng.Value)
End If
' returns TRUE if rng contains
' numeric values
End Function
3. Press <Alt+Q> to return to the Excel worksheet.
Now you can use this user-defined function in conditional
formatting.
4
To shade cells with valid numeric values:
1. In a worksheet, ...