How to using AutoFilter function for multiple Itmes via activeX?

조회 수: 9 (최근 30일)
Silvie
Silvie 2017년 1월 20일
답변: Silvie 2017년 1월 25일
Hello,
I am trying to "translate" the following VBA code into Matlab (using activeX)
Selection.AutoFilter 1, Array("2", "3", "5"), xlFilterValues
I know that xlFilterValue equals to 7 (Link).
So I coded in Matlab:
invoke(Excel.Range('B:B'), 'AutoFilter', Array("2", "3", "5"),7);
this unfortunately does not work at all (no filter item is selected). If I code the following:
invoke(Excel.Range('B:B'), 'AutoFilter', '1',7);
it works fine, but this is only a filter for one Item, and I want to create a filter for multiple Items.
Does anyone know how to do that?
Thank you
Jenny

채택된 답변

Silvie
Silvie 2017년 1월 25일
Finally I found the solution on my own:
invoke(Excel.Selection, 'AutoFilter', 1,... %Field
{'1', '3', '5'},... %Criteria1
7); %operator = xlFilterValues

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by