我正在尝试使用userform / comboboxes过滤运营商表。我在“Sheets(”Carrier“)行上收到错误.range.AutoFilter field:= 16,Criteria1:= ComboBoxA.value”。 “错误的参数数量或无效的属性赋值”
我删除了上一个问题,因为我在半夜添加了不良信息。
Public Sub CommandButton1_Click()
Dim strCriteria1 As String
Dim lastrow As Long, lastcol As Long
With Me
Select Case True
Case ComboBoxA.value <> "": strCriteria1 = ComboBoxA.value
'Case ComboBox1.value <> "": strCriteria1 = ComboBox1.value
'Case Else: Exit Sub
End Select
End With
With Sheets("Carrier")
'.ClearAllFilters
lastrow = .Cells(Rows.count, "E").End(xlUp).Row
lastcol = .Cells(1, Columns.count).End(xlToLeft).Column
.AutoFilterMode = False
If ComboBoxA.value <> "" Then
Sheets("Carrier").range.AutoFilter field:=16, Criteria1:=ComboBoxA.value
End If
End With
End Sub
答案 0 :(得分:1)
您尚未向Range
提供论据。例如。 Sheets("Carrier").range("A1").AutoFilter field:=16, Criteria1:=ComboBoxA.value