Spread 8.0 Documentation
SearchCol Method
Support Options
ActiveX Reference > ActiveX Methods > SearchCol Method

Glossary Item Box

SearchCol Method


See Also    DLL    Example

Applies To

fpSpread control

Description

Searches a column for a specified value or string.

Syntax

C++

long CSpreadSheet::SearchCol(long lCol, long lRowStart, long lRowEnd, LPCTSTR Text, long SearchFlags);

Visual Basic

fpSpread1.SearchCol(ByVal lCol As Long, ByVal lRowStart As Long, ByVal lRowEnd As Long, ByVal Text As String, ByVal SearchFlags As SearchFlagsConstants) As Long

Parameters

The following parameters are available:

Parameter Description
lCol Column in which to search
lRowStart Row at which to begin searching (row is not included in search)
lRowEnd Row at which to end searching
Set to –1 to search all rows.
Text Text for which to search
Set to an empty string ("") to search for empty cells.
SearchFlags Specify how the search is performed
Use the Or operator and combine the following values as indicated:
Value Constant Description
0 SearchFlagsNone Searches for exact match to complete text in cell, but ignores cases
1 SearchFlagsGreaterOrEqual Search for text or a value greater than or equal to the specified text or value
2 SearchFlagsPartialMatch Search for text that matches or partially matches the specified text
4 SearchFlagsValue Searches for text as if the text provided is equivalent to using the Value property
8 SearchFlagsCaseSensitive Search for text that exactly matches the text and case specified
Use one of the following values:
16 SearchFlagsSortedAscending Use for searching in columns that are sorted in ascending order. The method works more rapidly on a sorted column if you specify this setting.
32 SearchFlagsSortedDescending Use for searching in columns that are sorted in descending order. The method works more rapidly on a sorted column if you specify this setting.

Remarks

Use the SearchCol method to search for specified text or values in a column. To search for each occurrence of the text or value, call the SearchCol method and set the lRowStart parameter to –1. Then, call the SearchCol method again, specifying the returned row from the previous call as the value of the lRowStart parameter for each succeeding call. When the method returns –1, you have returned all occurrences of the text or value.

Note: Column headers are not searched.

This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.

Setting 4 (SearchFlagsValue) for the SearchFlags parameter lets you search for a value using the unformatted value of the data. For example, suppose the sheet had a currency value such as "i 4,451,493.00" in a cell. If you wanted to search for the unformatted value, 4451493.00, you could specify that unformatted value as the search string, and set the SearchFlags parameter to SearchFlagsValue to find the currency value without specifying any formatting. This might be useful if you are unsure of the currency symbol or some other formatting character that will be used in the data.

Use the SearchRow method to search for text or a value in a particular row.

Return Type

Number of row containing the search text. Returns –1 if search text is not found.

See Also

Searching for Data

Sheet, Value properties

SearchRow method

DLL Correspondence

SSSearchCol function

Copyright © GrapeCity, inc. All rights reserved.