Exceladd1ct
Board Regular
- Joined
- Feb 10, 2019
- Messages
- 76
Hello, i am trying set a Sheet reference to my (userform) listbox but nothing works so far.
There is an error when i have another workbook active at the time that the macro tries to refresh the listbox data. Which is to be expected since it is looking for the source data in the wrong workbook(by default, the active sheet from the active workbook).
I have set the RowSource for the ListBox from the Properties window, to a Dynamic Named Range called "extdata" in my "Data" Sheet.
I manage to have another workbook active than the one the code resides in because i run the UserForm from the VBA Editor.
There is an error when i have another workbook active at the time that the macro tries to refresh the listbox data. Which is to be expected since it is looking for the source data in the wrong workbook(by default, the active sheet from the active workbook).
VBA Code:
UserForm1.lstData.RowSource = "extdata"
VBA Code:
'So far i tried
UserForm1.lstData.RowSource = "Data!extdata" 'Invalid property value error
'and
UserForm1.lstData.RowSource = ThisWorkbook.Sheets("Data").Range("extdata").Address 'no error neither no data in the listbox
I manage to have another workbook active than the one the code resides in because i run the UserForm from the VBA Editor.