I have a userform that has a txtZip, Listbox1, & ComboBox1, cmdGetCity
Short Story: I want to search for the Zipcode (txtZip) and State (ComboBox1) columns - and if they match the row of data, display the name(s) of the Cit(ies) of that row (Column D) in Listbox1.
Long Story:
I want a function that whenever cmdGetCity is clicked, it will search the B2:B81832 range for a zipcode that matches txtZip (entered by user) and, also, search E2:E81832 for data that the users selects in the Combobox 1 (State - selected by user). All entries that are found, I would like all items that match those two criteria ti display column D's (name of Cities) contents in Listbox1.
This is what I have, but I keep getting an error 'Type Mismatch':
Short Story: I want to search for the Zipcode (txtZip) and State (ComboBox1) columns - and if they match the row of data, display the name(s) of the Cit(ies) of that row (Column D) in Listbox1.
Long Story:
I want a function that whenever cmdGetCity is clicked, it will search the B2:B81832 range for a zipcode that matches txtZip (entered by user) and, also, search E2:E81832 for data that the users selects in the Combobox 1 (State - selected by user). All entries that are found, I would like all items that match those two criteria ti display column D's (name of Cities) contents in Listbox1.
This is what I have, but I keep getting an error 'Type Mismatch':
Code:
Private Sub cmdGetCity_Click()
If (txtZip = Worksheets("Zipcodes").Range("B2:B81832")) & (ComboBox1 = Worksheets("Zipcodes").Range("E2:E81832")) Then
ListBox1.List = Worksheets("Zipcodes").Text("D")
End If
End Sub