自动过滤标准 [英] Autofilter criteria's
问题描述
大家好,
这可能非常简单,但我找不到答案。我想要实现的是我需要找到单个Excel的所有可能的自动筛选条件来自VBA的列表字段(列)。我知道我可以迭代列的单元格并且不加思索地找到值并将它们存储到数组中,但我真的很想知道是否有一个属性已经给了我。感谢,
Mohamed
Hello everyone,
This might be really simple but I couldn't find the answer for it.What I'm trying to achieve is that I need to find all the possible autofilter criteria's of a single Excel list field (Column) from VBA. I know I could just iterate over the column's cells and distnictly find the values and store them into an array, but I'd really be intrested to know if there is a property which already gives me that.
thanks,
Mohamed
推荐答案
您好,
如下所示可能就是你要找的东西:
Something like the following is probably what you are looking for:
A1应该有一个列标题
A1 should have a header for the columns
A2向下是你的数据。
A2 downwards is your data.
[code]
Sub test()
Range(" A1")。选择
Selection.AutoFilter
srchStr =" test5"
工作表(" Sheet1")。范围(" A1")。AutoFilter字段:= 1,_
Criteria1:= srchStr,VisibleDropDown:= False
End Sub
Sub test()
Range("A1").Select
Selection.AutoFilter
srchStr = "test5"
Worksheets("Sheet1").Range("A1").AutoFilter field:=1, _
Criteria1:=srchStr, VisibleDropDown:=False
End Sub
Chas
这篇关于自动过滤标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!