Raymondc190466
New Member
- Joined
- Aug 19, 2016
- Messages
- 24
- Office Version
- 365
- Platform
- Windows
Dear All,
I want ComboBox2 to be populated depending on the value choosen in ComboBox1.
I have created 3 name ranges:
Vendor = Column A => =OFFSET(Supplier!$A$2;1;0;COUNTA(Supplier!$A:$A)-1)
VendorNumber = Column B => =OFFSET(Supplier!$B$2;1;0;COUNTA(Supplier!$B:$B)-1)
Material = Column C => =OFFSET(Supplier!$C$2;1;0;COUNTA(Supplier!$C:$C)-1)
Present code to populate ComboBox1:
I have below code to populate the textbox7:
What code do I need to get this in the ComboBox1_Change and to fill Combobox2?
I want ComboBox2 to be populated depending on the value choosen in ComboBox1.
I have created 3 name ranges:
Vendor = Column A => =OFFSET(Supplier!$A$2;1;0;COUNTA(Supplier!$A:$A)-1)
VendorNumber = Column B => =OFFSET(Supplier!$B$2;1;0;COUNTA(Supplier!$B:$B)-1)
Material = Column C => =OFFSET(Supplier!$C$2;1;0;COUNTA(Supplier!$C:$C)-1)
Present code to populate ComboBox1:
Rich (BB code):
Private Sub UserForm_Initialize()
Set xRg = Worksheets("Supplier").Range("A2:C127")
Me.ComboBox1.List = xRg.Columns(1).Value
I have below code to populate the textbox7:
VBA Code:
Private Sub ComboBox1_Change()
'Select Supplier - ComboBox1, autofill Textbox7 with Suppliernumber
Dim xRg As Range
With Worksheets("Supplier")
Set xRg = .Range("A2:C" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
If IsError(Application.VLOOKUP(Me.ComboBox1.Value, xRg, 2, False)) Then
MsgBox "Start new Complaint " & Me.ComboBox1.Value
Else
Me.TextBox7.Text = Application.VLOOKUP(Me.ComboBox1.Value, xRg, 2, False)
End If
End Sub
What code do I need to get this in the ComboBox1_Change and to fill Combobox2?
Last edited: