excel - VBA 宏搜索自动筛选

标签 excel vba autofilter

我目前有一个搜索自动过滤器的代码,但会搜索我在引号中的确切内容。

ActiveSheet.Range(Selection, Selection.End(xlUp)).AutoFilter Field:=5, Criteria1:="CLO "

我需要的是一个代码,它将在每行中搜索过滤器中的单词“CLO”。所以说有一行写着“CLO 已被预订......”我希望它出现在搜索中。目前,我的搜索没有返回任何结果,因为它专门搜索“CLO”。

最佳答案

使用以下内容更新您的代码

ActiveSheet.Range(Selection, Selection.End(xlUp)).AutoFilter _
    Field:=5, Criteria1:="CLO *"
*表示只要文本以“CLO”开头,就会返回该行,而不管它后面的文本。

关于excel - VBA 宏搜索自动筛选,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17239180/

相关文章:

php - 使用 PHP 生成 MySQL 到 Excel

ios - 在 Swift 中下载和处理 .xls (Excel) 文件

Excel VBA : Setting a Cell Address to a variable "Object Required Error"

excel - POI自动过滤

vba - Excel VBA : How to create an autofilter with an exception to the filter?

Excel 365 VBA 日期在自定义自动过滤器中不起作用

excel - 删除空白 Excel 数据透视表条目

excel - 如何使用 Excel 公式将一个工作表中的单元格范围引用到另一个工作表?

vba - 将文本文件导入 xlsm,然后覆盖 sheetname(如果已存在)

excel - Application.WorksheetFunction.Match 方法