Ask Your Question
0

Help with Search Descriptor and FindAll()

asked 2018-01-05 20:41:06 +0200

CaptainCanuck76 gravatar image

Can someone explain how to use a Search Descriptor and FindAll() in order to determine if all cells in the same column contain the same exact value?

oSelection = oConstantSheet.getCellRangeByPosition(iColumn, iStartRow, iColumn, iRowCount) 'nLeft, nTop, nRight, nBottom
    'nLeft  is the column index of the first cell inside the range.
    'nTop   is the row index of the first cell inside the range.
    'nRight is the column index of the last cell inside the range.
    'nBottom    is the row index of the last cell inside the range.

oDescriptor = oSelection.createSearchDescriptor()
oDescriptor.SearchString = sConstantValue
oDescriptor.SearchWords = True
oFoundAll = oSelection.FindAll(oDescriptor)

I don't know how to access oFoundAll in order to find out how many sConstantValue were found

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2018-01-05 21:57:40 +0200

Jim K gravatar image

Method findAll() is from XSearchable and returns XIndexAccess with method getCount().

If oFoundAll.getCount() = iRowCount Then
    'Add code here'
End If

Also, your code does not look right, because the fourth parameter to getCellRangeByPosition() is the final row index, not a row count. Try this instead.

oSelection = oConstantSheet.getCellRangeByPosition(_
    iColumn, iStartRow, iColumn, iStartRow + iRowCount - 1)
edit flag offensive delete link more
0

answered 2018-01-05 20:53:33 +0200

Lupp gravatar image

I didn't try, but your oFoundAll should be an object with a .Count property and a .GetByIndex method. Indices are zero-based.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-01-05 20:41:06 +0200

Seen: 149 times

Last updated: Jan 05 '18