Reputation: 319
I am trying to populate textbox on userform based on 2 combobox selections? I cannot find any code to get close to this i can populate with 1 combobox but not 2 can anyone help?
Example if combobox1 = Cell E3 (Period 1) & combobox2 = Cell E4 (week) show Cell value E6 in Textbox1
If anyone can help I would be very greatful
Upvotes: 0
Views: 1464
Reputation: 319
concentrating the 2 text boxes in to 1 value and searching solved this issue
Private Sub CommandButton1_Click()
Dim Inp, Outp
Dim Rng As Range
Inp = TextBox1.Value
With Sheets("2018 - 2019").Range("E2:H2")
Set Rng = .Find(what:=Inp, after:=.Cells(.Rows.Count, 1), LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Outp = Rng.Offset(5, 0).Value
TextBox2.Value = Outp
End If
End With
End Sub
Upvotes: 1