DIAdem Help

Method: Find for Sheet

  • Updated2024-09-12
  • 1 minute(s) read

Method: Find for Sheet

Determines the position of a character or a character string in a worksheet of the open work folder. The search is executed rowwise.

Set oCellPosition = Object.Find(SearchText, [Row], [Column])
ObjectSheet
Object with this method
SearchTextString
Specifies the text to search for.
[Row]LongInteger
Specifies the row number from where the search starts.
[Column]LongInteger
Specifies the column number from where the search starts.
oCellPositionCellPosition
Returned object

The following example searches for the letter a in the first worksheet. The example saves the positions it finds in the properties of the channel group Find_Results:

Dim oSheet : Set oSheet = Workbook.Sheets(1)
Dim oGroup : Set oGroup = Root.ChannelGroups.Add("Find_Result")

Dim Count : Count = 0
Dim RetVal : Set RetVal = oSheet.Find("a")

While (RetVal.Row>0) and (RetVal.Column>0)
  Count = Count +1
  Call Group.Properties.Add("Pos" & Cstr(Count), Cstr(RetVal.Row) & "," & cstr(RetVal.Column)) 
  Set RetVal = oSheet.Find("a", RetVal.Row, RetVal.Column+1)
Wend