Private Sub TextBox1_Change()
TextBox2.Text = ""
If ComboBox1 <> "" And ComboBox2 <> "" And ComboBox3 <> "" Then
Dim Uriga1 As Long, R As Long, C As Long, X As Long, Riga As Object, Col As Object
Uriga = Range("A" & Rows.Count).End(xlUp).Row
C = Rows("1:1" & Columns.Count).End(xlToRight).Column
Set Col = Range(Cells(1, 1), Cells(1, C)).Find(ComboBox3.Text, LookIn:=xlValues, LookAt:=xlWhole)
If Not Col Is Nothing Then
C = Col.Column 'Row
End If
Set Riga = Range(Cells(1, 1), Cells(Uriga, 1)).Find(ComboBox1.Text, LookIn:=xlValues, LookAt:=xlWhole)
If Not Riga Is Nothing Then
R = Riga.Row
For X = X + 1 To X + 30
If Cells(R + X, 1) <> "" Then
If Cells(R + X, 1) = ComboBox2.Text Then
R = R + X
Exit For
End If
End If
Next X
End If
If TextBox1.Value = True Then
TextBox2.Text = TextBox1.Value * Cells(R, C)
End If
End If
End Sub |