This function returns the first column number which contains the given search string when operated in mode '1' & gives the cell co-ordinates of all the cell containing the given string when operateed in mode '2'
Public Function GetColumnWithCellText (TableObject,SearchString,OperationMode)
RowCount = TableObject.RowCount
For irow = 1 to RowCount
ColumnCount = TableObject.ColumnCount(irow)
For icol = 1 to ColumnCount
CellData = TableObject.GetCellData(irow, icol)
If Strcomp(CellData, SearchString, 1) = 0 Then
If flag <> 1 Then
flag = 1
FirstColumn = icol
End If
If len(HitsList) <> 0 Then
HitsList = HitsList& ";"
End if
HitsList = HitsList & "(" & irow & "," & icol & ")"
End If
NextNext
If OperationMode = 1 Then
' Return first column mode
GetColumnWithCellText = FirstColumn Else
If OperationMode = 2 Then
' Return All Cells containing the search string
GetColumnWithCellText = HitsList
Else GetColumnWithCellText = "Invalid Operation Mode"
End If
End If
Monday, January 19, 2009
Subscribe to:
Posts (Atom)
