J
J
John Smith2015-09-04 14:37:16
Macros
John Smith, 2015-09-04 14:37:16

Why does displaying autofilter criteria through a custom function not work when enabled from VBA?

There is a table with autofilters.
There is a VBA code for a function that, when "attacked" to a column cell, shows the autofilter selection conditions if selection is enabled : j-walk.com/ss/excel/usertips/tip044.htm
it is immediately clear whether the filtering table is subjected to, and if so, by what criterion and column. The screenshot below shows that column J is filtered by the "not equal to zero" filter:
6c7a8d8bf6e742fda01e863fabb4e4ae.png
However, this function works strangely:
- if you enter the filter manually, then the above function shows it
- if the filter is applied using vba, there are options:
-- If the filter is applied team

Application.CommandBars("Cell").FindControl(ID:=12232, Recursive:=True).Execute

(this is a filter "by the value of the current cell"), the FilterCriteria function also displays it.
-- If the filter is applied via .AutoFilter, for example,
ActiveSheet.Range("$A$9:$P$1115").AutoFilter Field:=10, Criteria1:="<>0", Operator:=xlAnd

then the function, although it should display "<>0", just like in the screenshot above, does not display anything.
Question: how to make the custom function FilterCriteria always display the filter criteria applied from vba (whether this is achieved by modifying the function or modifying the code that applies the filter).
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question