SearchFor |
This page in 2007 Top Previous Next |
|
Searches a specified area of a worksheet for cells that have been merged, selecting any that are found in a multi-area range. Applies to SYNTAX result1 = expression1.SearchFor Set result2 = expression2.SearchFor(Range1, Text, SearchType, MatchCase) 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, set either to all the merged cells found within Range1, or to Nothing if no merged cells are present. Range1 Required Range. The range in which to search for the specified text. Text Required String. The text to be searched for. SearchType SearchContentType. 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. MatchCase Required Boolean. True if the search is to be case sensitive. False if the search is to ignore any difference between the casing of the specified text and the contents of the cells being searched. Remarks When applied to an IOAKAddIn object, the SearchFor method performs some of the same action as the OAK | Search Selection | Conditional search command. It search for cells within the current selection that satisfy the required criteria. Other actions performed by that command are implemented by the SearchForValue method. When applied to an IOAKAPI object, the SearchFor method performs a conditional search within the range indicated by the parameter submitted to the method. Wrinkles When applied to an IOAKAddIn object, the SearchFor 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 zero or one area of merged cells is detected, just as the equivalent OAK user-interface command does. Example To highlight those cells, if any, in the current selection that make use of the deprecated function OFFSET in their formula: Dim r as Range |