Query my excel worksheet with VBA

孤者浪人 提交于 2019-11-27 15:42:20

You can programmtically create an AutoFilter, then select the matching values:

Dim ws As Worksheet: Set ws = ActiveSheet

With ws
    .AutoFilterMode = False
    .Range("1:1").AutoFilter
    .Range("1:1").AutoFilter field:=2, Criteria1:="=Saturday", Operator:=xlAnd
    With .AutoFilter.Range
        On Error Resume Next ' if none selected
        .Offset(1).Resize(.Rows.Count - 1).Columns(2).SpecialCells(xlCellTypeVisible).Select
        On Error GoTo 0
    End With
    .AutoFilterMode = False
End With
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!