乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>excel高级筛选VBA</em>-excel高级筛选 vba,excel vba 多条

<em>excel高级筛选VBA</em>-excel高级筛选 vba,excel vba 多条

作者:乔山办公网日期:

返回目录:excel表格制作


没图表,那个宏程序要根据你所在列和写筛选语言的。
示例:
Dim i, a, j, x As Integer
Dim w As String
Sheets("rework").Select
Cells.Clear
Sheets("sun").Select
x = InputBox("请输入e799bee5baa6e79fa5e98193e4b893e5b19e338你想查询的工号", "查询表格")
For i = 2 To 8
If Cells(1, 1) = "" Then
i = i + 1
End If
w = Cells(i, 238).Value
On Error Resume Next
Sheets(w).Select
Range("k1").Select
Selection.AutoFilter Field:=11, Criteria1:="=" & x, Operator:=xlAnd
Range("A2:o8000").Select
Selection.Copy
Sheets("rework").Select
a = Range("A65536").End(xlUp).Row + 1
Cells(a, 1).Select
ActiveSheet.Paste

worksheet_change事件输入以代码

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("C5")) Is Nothing And Target.Count = 1 And Target <> "" Then
Rows.Hidden = False
   For i = 8 To Cells(65536, 2).End(xlUp).Row
      If Cells(i, 2) <> Cells(5, 3) Then
                  Rows(i).Hidden = True
        End If
    Next
    End If
End Sub

Sub 筛选()
Columns("F:I") = ""
Dim I%
For I = 2 To Range("A65536").End(xlUp).Row
If Cells(2, 2) = "运输中" And InStr(Cells(I, 3), "裸素鱼竿") > 0 Then
n = n + 1
Cells(n + 1, "F") = Cells(I, 1)
Cells(n + 1, "G") = Cells(I, 2)
Cells(n + 1, "H") = Cells(I, 3)
Cells(n + 1, "I") = Cells(I, 4)
End If
Next
End Sub

上图 或者发样表
写清要求 感觉不难

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网