Also z.b. 3 Spalten
1 Spalte Länder (USA, Deutschland, Frankreich)
2 Spalte Automarke (BMW, VW etc.)
Dann soll man auf dem Formula per Checkbos auswählen können nur USA & VW.
Ich habe versucht es zu programmieren, aber scheitere an der Variablen für den Autofilter.
Ich habe beides versucht, sowohl per Array, als auch durch einen String der alle Filterwerte enthält.
Hoffentlich kann mir einer helfen.
Danke Euch.
Also hier mein Versuch für die Länder.
Private Sub CommandButton1_Click()
Dim OGFilterArray As String
Dim iLoop As Integer
Anzahl = 0
If cbox1 = True Then
Anzahl = Anzahl + 1
If cbox1 = True Then LandFilterArray = """Holland"""
Landfilterall = LandFilterArray
ReDim my_array(Anzahl)
my_array(Anzahl) = "Holland"
End If
If cbox2 = True Then
Anzahl = Anzahl + 1
If Anzahl > 0 Then LandFilterArray = " ,"
Landfilterall = Lanfilterall + LandFilterArray
If cbogcht = True Then LandFilterArray = """Spanien"""
Landfilterall = Landfilterall + LandFilterArray
ReDim my_array(Anzahl)
my_array(Anzahl) = "Spanien"
End If
If cbox3 = True Then
Anzahl = Anzahl + 1
If Anzahl > 0 Then LandFilterArray = " ,"
Landfilterall = Lanfilterall + LandFilterArray
If cbogcht = True Then LandFilterArray = """Russland"""
Landfilterall = Landfilterall + LandFilterArray
ReDim my_array(Anzahl)
my_array(Anzahl) = "Russland"
End If
ActiveSheet.Range("$A$4:$AP$3009").AutoFilter Field:=5, Criteria1:=my_array
End Sub