.
Sub findname
Dim oSheet 'A sheet from the Calc document.
Dim oRanges 'The NamedRanges property.
Dim oCritRange 'Range that contains the filter criteria.
Dim oDataRange 'Range that contains the data to filter.
Dim oFiltDesc 'Filter descriptor.
REM Range that contains the filter criteria
oSheet = ThisComponent.getSheets().getByIndex(2)
rem oCritRange = osheet.UseRegularExpressions() 'expression not found
oCritRange = oSheet.getCellRangeByName("aa9:aa10")
REM You can also obtain the range containing the
REM filter criteria from a named range.
REM oRanges = ThisComponent.NamedRanges
REM oRange = oRanges.getByName("AverageLess80")
REM oCritRange = oRange.getReferredCells()
REM The data that I want to filter
oSheet = ThisComponent.getSheets().getByIndex(2)
oDataRange = oSheet.getCellRangeByName("a11:p28")
oFiltDesc = oCritRange.createFilterDescriptorByObject(oDataRange)
rem oDataRange.filter(oFiltDesc)
REM Copy the output data rather than filter in place.
oFiltDesc.CopyOutputData = True
REM Create a CellAddress and set it for Sheet3,
REM Column B, Row 4 (remember, start counting with 0)
Dim x As New com.sun.star.table.CellAddress
x.Sheet = 16
x.Column = 0
x.Row = 0
oFiltDesc.OutputPosition = x
oDataRange.filter(oFiltDesc)
End Sub
.