t.mo
t.mo

Reputation: 263

What is my wrong argument or invalid property assignment?

I am trying to filter the Carrier sheet using the userform / comboboxes. I am receiving an error on the line " Sheets("Carrier").range.AutoFilter field:=16, Criteria1:=ComboBoxA.value". "Wrong number of arguments or invalid property assignment"

I jhave deleted a previous question as I added bad information in the middle of the night.

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

Upvotes: 0

Views: 208

Answers (1)

rory.ap
rory.ap

Reputation: 35318

You haven't provided an argument to Range. E.g. Sheets("Carrier").range("A1").AutoFilter field:=16, Criteria1:=ComboBoxA.value

Upvotes: 1

Related Questions