ListBox Error

P

Patrick Simonds

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?
 
K

keepITcool

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 :
 
Top