Board logo

標題: 可否篩選一個字顯示??? [打印本頁]

作者: sillykin    時間: 2013-8-30 20:24     標題: 可否篩選一個字顯示???

如果combox4.value 可否輸入一個文字就能篩選???
以下combox4是要符合一個項目才能篩選出答案。
我要如何更正呢???

Private Sub CommandButton1_Click() '篩選條件
Dim A, B, C, D, E, F
A = ComboBox4.Value
B = ComboBox1.Value
C = ComboBox2.Value
D = ComboBox3.Value
E = ComboBox5.Value
F = ComboBox7.Value


With ActiveSheet.Range("$A$1:$Q$300")
    .Parent.AutoFilterMode =
    If A <> "" Then .AutoFilter Field:=1, Criteria1:=A
    If B <> "" Then .AutoFilter Field:=2, Criteria1:=B
    If C <> "" Then .AutoFilter Field:=3, Criteria1:=C
    If D <> "" Then .AutoFilter Field:=4, Criteria1:=D
    If E <> "" Then .AutoFilter Field:=14, Criteria1:=E
    If F <> "" Then .AutoFilter Field:=17, Criteria1:=F
   
   
End With
End Sub


Private Sub CommandButton4_Click()
With ActiveSheet.Range("$A$1:$Q$300")
    .Parent.AutoFilterMode =
   
End With

End Sub



Private Sub UserForm_Initialize()
    Dim m As Object, A
    Dim n As Object, B
    Dim o As Object, C
    Dim p As Object, D
    Dim q As Object, E
    Dim r As Object, F
   
   
    Set m = CreateObject("Scripting.Dictionary")
    Set n = CreateObject("Scripting.Dictionary")
    Set o = CreateObject("Scripting.Dictionary")
    Set p = CreateObject("Scripting.Dictionary")
    Set q = CreateObject("Scripting.Dictionary")
    Set r = CreateObject("Scripting.Dictionary")
   
    With Sheet1
        For Each A In .Range("B3", .[B3].End(xlDown))
          m(A.Value) = ""
          Next
        For Each B In .Range("C3", .[C3].End(xlDown))
          n(B.Value) = ""
          Next
        For Each C In .Range("D3", .[D3].End(xlDown))
          o(C.Value) = ""
          Next
        For Each D In .Range("A3", .[A3].End(xlDown))
          p(D.Value) = ""
          Next
         For Each E In .Range("N3", .[N3].End(xlDown))
          q(E.Value) = ""
          Next
           For Each F In .Range("Q3", .[Q3].End(xlDown))
          r(F.Value) = ""
          Next
        
        
        ComboBox1.List = Application.Transpose(m.keys)
        
        ComboBox2.List = Application.Transpose(n.keys)
        
        ComboBox3.List = Application.Transpose(o.keys)
        
        ComboBox4.List = Application.Transpose(p.keys)
        
        ComboBox5.List = Application.Transpose(q.keys)
        ComboBox7.List = Application.Transpose(r.keys)
        
        End With
   

End Sub




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)