Hello Excel Experts,
I am developing an VBA code when-in i need to match 2 criterias to pull the values for a specific table.
In the attached file, i have provided the sample data in 2 sheets and the criteria's to match is 'Product1' and 'City1'. With these 2 as criterias, i am determining the table to pull the data/values.
I have developed the code below but this never considers "A1" in its search.
In every Do..Until loop, it gives output of only 'Product1/City2'. What i am doing wrong here.? Why doesn't this code it find 'Product1' of 'A1' cell.?
Sorry if my question is too silly. Thanks for your advise in advance.
Sub findProductscity()
Dim prodFound As Boolean
Dim CityFound As Boolean
Dim prodCell As Range
With Sheets("Input").Cells
Do
Set prodCell = .Find(What:="*Product1*", LookIn:=xlValues) ' NEED TO CORRECT THIS-Doesnt search A1 cell
If Not prodCell Is Nothing Then
prodFound = True
If Right(Trim(prodCell), 4) = Left(Trim(Worksheets("Data").Cells(1, 1).Value), 4) Then CityFound = True
End If
Loop Until prodFound = True And CityFound = True
End With
End Sub
Bookmarks