SearchForConstantFormula

This page in 2003
Top  Previous  Next

Searches a specified area of a worksheet for cells that have contain a constant formula, selecting any that are found in a multi-area range.

An example of a constant formula is =22/7.  It is a formula, in that it starts with an equals sign; but it makes no reference to other cells as precedents, so it will always give the same answer.  The danger with such cells is that they might be overlooked when performing an exhaustive check of the inputs to a spreadsheet, since they will not appear in a listing of constants produced by OAK or any similar package, nor be identified by Home | Find & Select | Go To Special | Constants command.

Applies to

IOAKAddIn, IOAKAPI

SYNTAX

result1 = expression1.SearchForConstantFormula

Set result2 = expression2.SearchForConstantFormula(Range1)

expression1   Required.  An expression that returns an IOAKAddIn object.

expression2   Required.  An expression that returns an IOAKAPI object.

result1   An OAKResult enumeration indicating the success or otherwise of the action.

result2   A Range consisting of all the cells containing a constant formula found within Range1, or Nothing if no such cells are found

Range1           Required Range.  The range in which to search for cells containing a constant formula.

Remarks

When applied to an IOAKAddIn object, the SearchForConstantFormula method performs the same action as the OAK Development | Search | Constant formula cells command.   It searches for cells containing a constant formula within the current selection.

When applied to an IOAKAPI object, the SearchForConstantFormula method applies searches for cells containing a constant formula within the range indicated by the parameter submitted to the method.

Wrinkles

When applied to an IOAKAddIn object, the SearchForConstantFormula method follows the One-cell rule.  When applied to an IOAKAPI object, it does not: if supplied a Range parameter describing a single cell, it will look in that cell only.

When applied to an IOAKAddIn object, the method will display a dialog box if no cells containing a constant formula are detected, just as the equivalent OAK user-interface command does.