Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating List Box 1

Status
Not open for further replies.

johnny45

Technical User
Nov 8, 2006
136
CA
Hello,
I'm getting an error with this:

Private Sub UserForm_Initialize()

Me.lbxCustomers.List = Sheet1.Range("A2", Cells(Rows.Count, 1).End(xlUp)).Value

End Sub
if sheet1 is active there is no error however if another sheet is active then I get a Method Range of worksheet failed...

what am I missing ?
 




Hi,

Reference Sheet1 with ALL ranges...
Code:
with Sheet1
  Me.lbxCustomers.List = .Range(.[A2], .Cells(Rows.Count, 1).End(xlUp)).Value
end with

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top