Jaye Cavallo
New Member
- Joined
- Mar 10, 2022
- Messages
- 47
- Office Version
- 2016
- Platform
- Windows
Hello,
I am hoping to create a userform in one Excel workbook with a link to the named range in another Excel workbook. So, the first Excel file would have userform that would have a combobox that is be populated with elements of the named range in a different excel file. I have to share my Excel workbook with many co-workers. I have to share a new Excel workbook everytime the elements of the named range change. I would like the Excel file with the userform point to the named range on a shared drive, so all I would need to do is update the elements of the named range and the change would be reflected in all of the workbooks of my co-workers.
I have the below, but receive a subscript out of range error. Any help would be appreciated.
Dim rngDepartment As Range
Dim wb As Workbook
Set wb = Application.Workbooks("options.xlsm")
wb.Activate
Dim ws As Worksheet
Set ws = Worksheets("Options")
For Each rngDepartment In wb.Range("Department")
With Me.cboDepartment
.AddItem rngDepartment.value
End With
Next rngDepartment
I am hoping to create a userform in one Excel workbook with a link to the named range in another Excel workbook. So, the first Excel file would have userform that would have a combobox that is be populated with elements of the named range in a different excel file. I have to share my Excel workbook with many co-workers. I have to share a new Excel workbook everytime the elements of the named range change. I would like the Excel file with the userform point to the named range on a shared drive, so all I would need to do is update the elements of the named range and the change would be reflected in all of the workbooks of my co-workers.
I have the below, but receive a subscript out of range error. Any help would be appreciated.
Dim rngDepartment As Range
Dim wb As Workbook
Set wb = Application.Workbooks("options.xlsm")
wb.Activate
Dim ws As Worksheet
Set ws = Worksheets("Options")
For Each rngDepartment In wb.Range("Department")
With Me.cboDepartment
.AddItem rngDepartment.value
End With
Next rngDepartment