Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Filling Lists with Workbook_Open

Hello guys,

I'm trying to fill various lists at the workbook_open event (at startup).

This is what i have in the class named "Startup"

Option Explicit
Dim ws As Worksheet, rng As range, lst As ListObject

Sub fillLists(rng)
Set ws = Sheets("CODE")
Set rng = ws.range(rng)
Set lst = ws.ListObjects.Add(xlSrcRange, rng, , xlYes)
End Sub

And this is my code in the class "ThisWorkbook":

Option Explicit
Dim listRob As New Startup
Private Sub Workbook_Open()
listRob.fillLists ("A2:A8")
End Sub

The call to fillLists gives me the following error:

"Error 1004". Application or Object-defined error

What am i doing wrong here?

Thanks in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Filling Lists with Workbook_Open

All looks a bit skewy.

What is listRob? If it is a listbox somewhere, perhaps the code should be

Private Sub Workbook_Open()
listRob.List = Sheets("CODE").Range("A2:A8")
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Memento" wrote in message
...
Hello guys,

I'm trying to fill various lists at the workbook_open event (at startup).

This is what i have in the class named "Startup"

Option Explicit
Dim ws As Worksheet, rng As range, lst As ListObject

Sub fillLists(rng)
Set ws = Sheets("CODE")
Set rng = ws.range(rng)
Set lst = ws.ListObjects.Add(xlSrcRange, rng, , xlYes)
End Sub

And this is my code in the class "ThisWorkbook":

Option Explicit
Dim listRob As New Startup
Private Sub Workbook_Open()
listRob.fillLists ("A2:A8")
End Sub

The call to fillLists gives me the following error:

"Error 1004". Application or Object-defined error

What am i doing wrong here?

Thanks in advance.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Text Lists copying, not filling BCBrandt Excel Discussion (Misc queries) 0 January 17th 11 07:13 PM
Multiple lists with repeated values for dependet drop down lists mcmanusb Excel Worksheet Functions 1 September 29th 06 12:13 AM
Filling out list based on other lists Chris W via OfficeKB.com Excel Discussion (Misc queries) 2 October 11th 05 11:18 PM
filling information from one cell and filling another. Dianne Excel Worksheet Functions 1 August 15th 05 08:14 PM
Pulldowns or pick lists for filling cells. Brad[_9_] Excel Programming 1 September 23rd 03 07:51 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"