Find
The Find method is used to find a target string within range. It returns reference to a WksRange object.
Syntax
object. Find( TargetStr, After, Scope, Method, MatchCase, DelSelFirst, FindAll, OrderByRows )
Parameter |
Type |
Required /Optional |
Default |
Description |
TargetStr |
String |
Required |
|
This is the text to be found. |
After |
WksRange |
Required |
|
This must contain reference to a single cell. The search will start after this cell. |
Scope |
Optional |
wksFindScopeEntire |
This is the equivalent to the search order. the Scope controls the direction of the search: down through columns, to the right across rows, or both. |
|
Method |
Optional |
wksFindExact |
The Search method determines how the search is performed. Find the exact information, a phrase, all words or any words. |
|
MatchCase |
Boolean |
Optional |
True |
If the TargetStr parameter has case-sensitive words that need to be matched, then set MatchCase to be True. |
DelSelFirst |
Boolean |
Optional |
False |
DelSelFirst should be set to True, to deselect all selected cells before performing the search. |
FindAll |
Boolean |
Optional |
True |
FindAll should be set to True, to find all occurrences of the Find criteria in the work sheet. |
OrderByRows |
Boolean |
Optional |
True |
OrderByRows should be set to True, if it should finish searching a row, before going to the next row and False, if it should finish searching a column, before going to the next column. |
Example
The example finds 90 within the worksheet range covering columns A to C.
Dim SurferApp As Object
Set SurferApp = CreateObject("Surfer.Application")
SurferApp.Visible = True
'Open the worksheet document
Set Wks = SurferApp.Documents.Open(SurferApp.Path+"\Samples\demogrid.dat")
'Specify the worksheet range to Columns A-C
Set WksRange = Wks.Columns(Col1:=1, Col2:=3)
'Find "90" after the first cell of A1
WksRange.Find(TargetStr:="90", After:=Wks.Range(1,"A",1,"A"), Scope:=wksFindScopeEntire, Method:=wksFindExact, FindAll:=True)
Used by: WksRange object