mardi 13 juillet 2021

Run-time error '13': type mismatch when using if statement

I'm trying to configure autofilters bottom X items for Spain to be different then other territories and I'm getting Run-time error'13': Type mismatch

Sub Only_Choose_Unders()
' Only_Choose_Unders Macro
 If [Lab UP no 360 Chem OPP!D2] Like "1A. Madrid" Or "1B. Madrid" Or "2A. Barcelona" Or "2B. Barcelona" Or "3. Valencia" Or "4A. Malaga" Or "4B. Sevilla" Or "5. Bilbao" Or "6. Canarias" Or "7. Baleares" Or "8. NorOeste" Then
    With Sheets("Lab UP no 360 Chem OPP").Range("k24:k5000")
        .AutoFilter Field:=8, Criteria1:="50", _
         Operator:=xlBottom10Items
         .AutoFilter Field:=9, Criteria1:="50", _
         Operator:=xlBottom10Items
    End With
Else
    With Sheets("Lab UP no 360 Chem OPP").Range("k24:k5000")
        .AutoFilter Field:=8, Criteria1:="10", _
        Operator:=xlBottom10Items
        .AutoFilter Field:=9, Criteria1:="10", _
        Operator:=xlBottom10Items
    End With
End If
End Sub

Aucun commentaire:

Enregistrer un commentaire