Hello Everyone! Hope you all are fine.
First, I want to apologize if there's already a thread about this subject, I searched a lot and didn't found anything that could help me with my problem.
So, I'm trying to use VBA userform to look for two criterias from my worksheet.
<tbody>
</tbody>
So, what I'm trying to do is a userform that look for both information (Product and Flavor) typed by the customer, like this (It's in portuguese, but it won't confuse you):
But when I type to search any product/flavor that ISN'T the first item of the list, it doesn't find and says that it was unable to get the Index property...
I'm using this code:
Thanks in advance.
First, I want to apologize if there's already a thread about this subject, I searched a lot and didn't found anything that could help me with my problem.
So, I'm trying to use VBA userform to look for two criterias from my worksheet.
A1 | A2 | A3 |
Product | Flavor | Price |
Ice Cream | Chocolate | 5 BRL |
Ice Cream | Strawberry | 6 BRL |
Popsicle | Grape | 2 BRL |
Popsicle | Vanilla | 2,50 BRL |
<tbody>
</tbody>
So, what I'm trying to do is a userform that look for both information (Product and Flavor) typed by the customer, like this (It's in portuguese, but it won't confuse you):
But when I type to search any product/flavor that ISN'T the first item of the list, it doesn't find and says that it was unable to get the Index property...
I'm using this code:
Code:
Private Sub CommandButton1_Click()
Dim produto As String
Dim Sabor As String
produto = TextBox1.Text
Sabor = TextBox2.Text
TextBox3 = "R$" & Application.WorksheetFunction.Index(Range("C2:C5"), _
Application.WorksheetFunction.Match(produto, Range("A2:A5"), 0), _
Application.WorksheetFunction.Match(Sabor, Range("B2:B5"), 0))
End Sub
Thanks in advance.