Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I am trying to use a named range as the source of items for my listbox. This line creates the named range. It's in a standard module in my workbook.
The named range is named "data_file_list" and refers to a range in a second workbook (wb_sched, worksheet temp_ws) columns B and C. Data fills these columns from row 1 (header) to 165.
This is the code in which I populate the listbox.
I receive a "Method 'Range' of object '_Global' failed." error with the line in red.
Rich (BB code):
Workbooks("Sports17.xlsm").Names.Add Name:="data_file_list", RefersTo:="=OFFSET('[" & wb_sched.Name & "]" & temp_ws.Name & "'!$B$1,1,0,count('[" & wb_sched.Name & "]" & temp_ws.Name & "'!$A:$A),2)"
The named range is named "data_file_list" and refers to a range in a second workbook (wb_sched, worksheet temp_ws) columns B and C. Data fills these columns from row 1 (header) to 165.
This is the code in which I populate the listbox.
Rich (BB code):
With .uf1_listbox1
.ForeColor = RGB(0, 52, 89)
.Clear
.ColumnCount = 2
.ColumnWidths = "75;25"
.List = Range("data_file_list").Value
.ListStyle = fmListStyleOption
.Locked = True 'do not unlock until missing rentals are 0
End With
I receive a "Method 'Range' of object '_Global' failed." error with the line in red.