Hi everyone
with this code, in the combobox, I get the list of sheets in the 'orders' workbook.
I would like that when I select an item, the listbox would be populated with the data present in the A4: J110 range of the sheet, with the name of the selected item.
I tried assigning a variable to the combobox value to load the data but it tells me that the source is not valid
Please can you explain to me how I can do it
with this code, in the combobox, I get the list of sheets in the 'orders' workbook.
I would like that when I select an item, the listbox would be populated with the data present in the A4: J110 range of the sheet, with the name of the selected item.
VBA Code:
Private Sub UserForm_Initialize()
Dim i As Long
Dim Databook As Workbook
Application.ScreenUpdating = False
Set Databook = Workbooks.Open(ThisWorkbook.Path & "/" & "ordini.xlsm")
For i = 1 To Sheets("Foglio1").Range("A100").End(xlUp).Offset(1, 2).Row
Me.ComboBox1.AddItem Sheets("Foglio1").Cells(i, 2)
Next i
Databook.Save
Databook.Close
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox1_Change()
txtbox1.Value = ComboBox1.Value
End Sub
Private Sub txtbox1_Change() 'textbox whose value initializes the listbox
End Sub
I tried assigning a variable to the combobox value to load the data but it tells me that the source is not valid
Please can you explain to me how I can do it