Error Trying To Populate ListBox With A Named Range

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. 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.

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.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top