direktoren
Jun 1st, 2006, 05:12 AM
Hi all
I'm trying to make a new reporting tool, and bounced into trouble right away.
So far I have a datasheet (huge), and a starting page. On this starting page I have 5 comboboxes, default names are used, so they are called combobox1 to 5.
I want the list in the combobox1 to 5, to consist of column a to e on the data sheet (about 30000 rows, but only 15 different valules).
My code is;
Private Sub workbook_open()
Dim sSheet As Worksheet
Dim dSheet As Worksheet
Dim aArray As Variant
Dim bArray As Variant
Dim cArray As Variant
Dim dArray As Variant
Dim eArray As Variant
Dim i As Integer
Set sSheet = ActiveWorkbook.Sheets("Start")
Set dSheet = ActiveWorkbook.Sheets("data")
With ActiveWorkbook.dSheet
aArray = .Range(.Cells(2, 1), .Cells(65000, 1))
bArray = .Range(.Cells(2, 2), .Cells(65000, 2))
cArray = .Range(.Cells(2, 3), .Cells(65000, 3))
dArray = .Range(.Cells(2, 4), .Cells(65000, 4))
eArray = .Range(.Cells(2, 5), .Cells(65000, 5))
End With
For i = LBound(aArray) To UBound(aarray)
sSheet.combobox1.AddItem aarray(i)
Next i
End Sub
I've also tried using listfillrange - but this rendered me with the same result;
"Compile Error: Method or data member not found"
What am I missing??
I'm trying to make a new reporting tool, and bounced into trouble right away.
So far I have a datasheet (huge), and a starting page. On this starting page I have 5 comboboxes, default names are used, so they are called combobox1 to 5.
I want the list in the combobox1 to 5, to consist of column a to e on the data sheet (about 30000 rows, but only 15 different valules).
My code is;
Private Sub workbook_open()
Dim sSheet As Worksheet
Dim dSheet As Worksheet
Dim aArray As Variant
Dim bArray As Variant
Dim cArray As Variant
Dim dArray As Variant
Dim eArray As Variant
Dim i As Integer
Set sSheet = ActiveWorkbook.Sheets("Start")
Set dSheet = ActiveWorkbook.Sheets("data")
With ActiveWorkbook.dSheet
aArray = .Range(.Cells(2, 1), .Cells(65000, 1))
bArray = .Range(.Cells(2, 2), .Cells(65000, 2))
cArray = .Range(.Cells(2, 3), .Cells(65000, 3))
dArray = .Range(.Cells(2, 4), .Cells(65000, 4))
eArray = .Range(.Cells(2, 5), .Cells(65000, 5))
End With
For i = LBound(aArray) To UBound(aarray)
sSheet.combobox1.AddItem aarray(i)
Next i
End Sub
I've also tried using listfillrange - but this rendered me with the same result;
"Compile Error: Method or data member not found"
What am I missing??