5/28/2023 0 Comments Libreoffice basic examples![]() ![]() That code works fine when trying to filter Column A to a SINGLE value. TheRange.refresh() ' Finally, invoke the filter tFilterFields(theFilterFields) ' Place the FilterFields array into the descriptor UseRegularExpressions = FALSE ' FilterDescriptor TheFilterDesc = theRange.getFilterDescriptor(TRUE) ' Get an EMPTY FilterDescriptor ![]() TheFilterFields(1) = aFilterField ' Add the second FilterField to FilterFields array TheFilterFields(0) = aFilterField ' Add the first FilterField to the FilterFields arrayĪFilterField.Connection = 0 ' Define a CONTAINS filterĪFilterField.Operator = .FilterOperator2.CONTAINS ReDim theFilterFields(1) ' Redimension the FilterFields arrayĪFilterField = New .TableFilterField ' Create a FilterFieldĪFilterField.Connection = 0 ' 0 = AND, 1 = OR (irrelevant for item 0)ĪFilterField.IsNumeric = FALSE ' Define an EQUAL filterĪFilterField.Operator = .FilterOperator.EQUAL ![]() ' Get the Database Range we're going to filter Here is some prototype code that imposes a filter showing rows where column A EQUALS “Value1” and column K CONTAINS “Value2”: Sub CreateFilterĭim theFilterDesc As Object ' A FilterDescriptor Objectĭim theFilterFields() As Object ' An Array of FilterField objectsĭim aFilterField As Object ' A single item for the FilterFields Array The sheet holds a database with 17 columns, Headers in the first row, and AutoFilter in place. I’m trying to develop a macro that allows me to define and save AutoFilter settings so that I can quickly impose complex filters on a sheet. ![]()
0 Comments
Leave a Reply. |