|
▼GREEN さん:
こんにちは
これで如何かな?
Dim CT2 As Range, CE As Long, C As Range
Dim kub As String, ttan As String, tyoku As String
With ActiveSheet
CE = .Range("A65536").End(xlUp).Row
If .AutoFilterMode = False Then
.Rows(2).AutoFilter
End If
kub = Me.ComboBox48.Value '区分の検索条件入力
ttan = Me.ComboBox49.Value '担当者の検索条件入力
tyoku = Me.ComboBox50.Value '直間の検索条件の入力
If kub <> "" Then
.Range("B2:B" & CE).AutoFilter Field:=2, Criteria1:=kub '区分の検索条件がなければ無視
End If
If ttan <> "" Then
.Range("C2:C" & CE).AutoFilter Field:=3, Criteria1:=ttan '同じく、担当者
End If
If tyoku <> "" Then
.Range("D2:D" & CE).AutoFilter Field:=4, Criteria1:=tyoku '同じく、直間
End If
Set CT2 = .Range("A3:A" & CE).SpecialCells(xlCellTypeVisible)
Me.ListBox1.Clear
For Each C In CT2
Me.ListBox1.AddItem C.Value
Next C
Set CT2 = Nothing
.AutoFilterMode = False
End With
|
|