Hi! I have a userform and by clicking a commanbutton i would like to show another form that has one combo and six textboxes with its data. I have done some research according to which a public variable has to be set but i do not exactly understand how to do it..Could somebody help? Thank you! This is the code i'm using to initialize and display the userform that i want to be called but i'm not sure if it matters...
Code
Private Sub UserForm_Initialize()
With ComboBox1
.ColumnCount = 1
.List = Range("A2:J3000").Value
End With
End Sub
Private Sub ComboBox1_Change()
UserForm2.TextBox1.Value = WorksheetFunction.VLookup(ComboBox1.Value, Range("A2:J10000"), 1, False)
UserForm2.TextBox2.Value = WorksheetFunction.VLookup(ComboBox1.Value, Range("A2:J10000"), 2, False)
UserForm2.TextBox3.Value = WorksheetFunction.VLookup(ComboBox1.Value, Range("A2:J10000"), 3, False)
UserForm2.TextBox4.Value = WorksheetFunction.VLookup(ComboBox1.Value, Range("A2:J10000"), 4, False)
UserForm2.TextBox5.Value = WorksheetFunction.VLookup(ComboBox1.Value, Range("A2:J10000"), 6, False)
UserForm2.TextBox6.Value = WorksheetFunction.VLookup(ComboBox1.Value, Range("A2:J10000"), 7, False)
End Sub
Display More