|
Sub 筛选()
Application.ScreenUpdating = False
Dim ob As OLEObject
yf = [h1]
If yf = "" Then MsgBox "请输入月份!": End
r = Cells(Rows.Count, 2).End(xlUp).Row
AutoFilterMode = False
Rows(2).AutoFilter
For Each ob In ActiveSheet.OLEObjects
If ob.Object.Value = True And Left(ob.Name, 12) = "OptionButton" Then
If ob.Object.Caption = "全部" Then GoTo 10
mc = Replace(ob.Object.Caption, "公司", "")
Range("a2:g" & r).AutoFilter Field:=2, Criteria1:=yf, Operator:=xlAnd
Range("a2:g" & r).AutoFilter Field:=3, Criteria1:=mc, Operator:=xlAnd
Exit For
End If
Next
10:
Application.ScreenUpdating = True
End Sub
|
|