Sub Schaltfläche1_Klicken()
Dim towns(1 To 5) As String
Dim people(1 To 5) As String
Dim filter_string As String
filter_string = InputBox("Geben Sie ein Stadtfilter an", "Filter eingabe", "Berlin")
Dim filter_people_string As String
filter_people_string = InputBox("Geben Sie ein Personenfilter an", "Filter eingabe", "Peter")
Dim read_cell As String
Dim read_people_cell As String
For i = 1 To UBound(towns)
read_cell = Cells(i, 1)
read_people_cell = Cells(i, 2)
towns(i) = read_cell & "|" & read_people_cell
Debug.Print towns(i)
Next
found_town = Filter(towns, filter_string, True)
found_people = Filter(found_town, filter_people_string, True)
Dim wohnen_string As String
wohnen_string = "wohnt"
If (UBound(found_people) + 1) > 1 Then
wohnen_string = "wohnen"
End If
Cells(1, 3) = (UBound(found_people) + 1) & " " & filter_people_string & " " & wohnen_string & " in " & filter_string
MsgBox (UBound(found_people) + 1) & " " & filter_people_string & " " & wohnen_string & " in " & filter_string
End Sub