I currently have a userform which the user choses a selection from the Combobox and the other textboxes populate data dependant on what was chosen, this all goes well however I am unable to get the listbox populated. The listbox data (named ranges) are on a different sheet called SITES (Column C is a named range, As is Column D all the way through to column K)
What needs adding is something like
Me.Listbox1 = Value=Worksheets(“SITES”).range (“NAMED RANGE)
However I am struggling with the correct syntax, obviously Listbox1 is dependant on what is chosen in Combobox1, So if NORTH is chosen Listbox1 will show the named range called ‘NORTH’ etc.
It is only a one column listbox (for now!) but will probably expand as the data gets bigger.
Any help appreciated
HTML:
Private Sub ComboBox1_Change()
Dim Look As Range
Set Look = Worksheets("OFFICES").Range("A2:K10").Find(what:=Me.ComboBox1.Value, _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Look Is Nothing Then
MsgBox "No match for " & Me.ComboBox1.Value, , "No Match Found"
Else
Me.TextBox11.Value = Worksheets("OFFICES").Range("B" & Look.Row)
Me.TextBox12.Value = Worksheets("OFFICES ").Range("C" & Look.Row)
Me.TextBox13.Value = Worksheets("OFFICES ").Range("F" & Look.Row)
Me.TextBox14.Value = Worksheets("OFFICES ").Range("H" & Look.Row)
End If
End Sub
What needs adding is something like
Me.Listbox1 = Value=Worksheets(“SITES”).range (“NAMED RANGE)
However I am struggling with the correct syntax, obviously Listbox1 is dependant on what is chosen in Combobox1, So if NORTH is chosen Listbox1 will show the named range called ‘NORTH’ etc.
It is only a one column listbox (for now!) but will probably expand as the data gets bigger.
Any help appreciated