I’m trying to write a macro that can find all cells with the same content as the one in current selected cell.
Below is what I get so far:
Sub FindAll()
sheet = ThisComponent.CurrentController.ActiveSheet
desc = sheet.createSearchDescriptor()
cell = ThisComponent.CurrentSelection.getCellByPosition(0,0)
desc.SearchString = cell.String
findings = sheet.findAll(desc)
ThisComponent.CurrentController.select(findings)
End Sub
What still missing is:
- Cells containing formula is not included in the search results (
XSearchable.findAll
) - The macro always end up to set the first occurrence to be “active to edit” status (I’m not sure the accurate name of this status of cell), so the gui will always get navigated to the position of the first occurence, instead of the cell I have selected before I run the macro
Any one can help me to complete my script by solving these two problems above?