G
Guest
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.
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.