I'm currently designing a multiple userform excel sheet and have come across an issue when returning values for 4 text boxes (labourbox1,labourbox2,labourbox3,labourbox4) as they are returning value from the same column using the same criteria reference it only displays the first cell in that column using that reference.
this userform is displayed once a button is pressed on another userform and will then use the value from "ContainerBox1" as the criteria for the second userform from there the text boxes in the second userform are populated partly from the first userbox as well as the data sheet.
this userform is displayed once a button is pressed on another userform and will then use the value from "ContainerBox1" as the criteria for the second userform from there the text boxes in the second userform are populated partly from the first userbox as well as the data sheet.
VBA Code:
Private Sub UserForm_Initialize()
Dim A As Variant, B As Variant, C As Variant, D As Variant
Me.ContainerCMBVF.Text = QueryForm.ContainerBox1.Value
Me.ClientBoxVF.Text = QueryForm.ClientBox1.Value
Me.AgencyBoxVF.Text = QueryForm.AgencyBox1.Value
Me.TaskBoxVF.Text = QueryForm.TaskBox1.Value
Me.DateBoxVF.Text = QueryForm.DateBox1.Value
A = ContainerCMBVF.Value
Sheets("Planning").Activate
If A = "" Then
B = ""
Let LabourBox1VF.Text = B
C = ""
Let LabourBox2VF.Text = C
D = ""
Let LabourBox3VF.Text = D
Else
B = Application.WorksheetFunction.Index(Sheets("Planning").Range("D2:D100"), Application.WorksheetFunction.Match(A, Sheets("Planning").Range("E2:E18"), 0))
Let LabourBox1VF.Text = B
C = Application.WorksheetFunction.Index(Sheets("Planning").Range("D2:D100"), Application.WorksheetFunction.Match(A, Sheets("Planning").Range("E2:E18"), 1))
Let LabourBox2VF.Text = C
D = Application.WorksheetFunction.Index(Sheets("Planning").Range("D2:D100"), Application.WorksheetFunction.Match(A, Sheets("Planning").Range("E2:E18"), 1))
Let LabourBox3VF.Text = D
End If
End Sub