SearchForValue

This page in 2003
Top  Previous  Next

Searches a specified area of a worksheet for cells that fall into a range of values.

Applies to

IOAKAPI

SYNTAX

Set result1 = expression1.SearchForValue(Range1, type , value0, [value1])

expression1   Required.  An expression that returns an IOAKAPI object.

result1   A Range containing of all the cells within Range1 that match value0, and may be value1; or Nothing if no such cells are found.

Range1           Required Range.  The range in which to search for cells that are not mentioned by any formula.

type   Required SearchMatchType Indicates what kind of search to perform.  One of SearchMatchType_Contains, SearchMatchType_DoesNotContain, SearchMatchType_EndsWith, SearchMatchType_Equals, SearchMatchType_GreaterThan, SearchMatchType_GreaterThanOrEqualTo, SearchMatchType_IsBetween, SearchMatchType_IsNotBetween, SearchMatchType_LessThan, SearchMatchType_LessThanOrEqual,  SearchMatchType_NotEquals, SearchMatchType_StartsWith.

value0   Required Variant.  The value being searched for.

value1   Optional Variant.  The value being searched for.  Only needed when type is SearchMatchType_IsBetween.

Remarks

The IOAKAddIn method that corresponds to the conditional search facilities offered by the OAK user interface is SearchFor.   That method is offered for IOAKAPI too, but the combination of parameters only supports some of the search functionality.  The functionality not conveniently implemented by SearchFor is caught by this SearchForValue method.  For this reason, SearchFor is a method of both IOAKAddIn and IOAKAPI, but SearchForValue is a method of IOAKAPI only.

Wrinkles

When operated through the user interface, OAK's conditional search follows the One-Cell rule.  The SearchForValue does not; if supplied a Range1 parameter describing a single cell, it will look in that cell only.