ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBox Error (https://www.excelbanter.com/excel-programming/304816-listbox-error.html)

Patrick Simonds

ListBox Error
 
I have a Workbook named Weekly Projections.xls the worksheet which is
viewed for data entry is named Projections, this is also the sheet where
the ListBox is called from. I want to use data on worksheet Work Shifts
Drivers (located in the same workbook).

Here is the code I was trying:

Private Sub Userform_Initialize()

ListBox1.RowSource = Worksheets("Weekly Projections.xls"). _
Worksheets("Work Shifts Drivers").Range("B5:B50").Address(external:=True)

End Sub

but when I run the code I get the following error:

run-time error '9'
Subscript out of range

Any ideas as to where I have gone wrong?



keepITcool

ListBox Error
 

sheets/books typo :)

ListBox1.RowSource = WorkBOOKS("Weekly Projections.xls"). _
Worksheets("Work Shifts Drivers").Range("B5:B50")._
Address(external:=True)


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Patrick Simonds wrote :



All times are GMT +1. The time now is 02:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com