Hi,
I am having problems with populating 11 columns in my ListBox6.
The following code gives me a Run-Time error 380 "Could not set the List property. Invalid property value." when I am creating column 11 .List(.ListCount - 1, 10) = Me.ListBox5.List(x, 8) . If I were to remove the statement (make it a comment) the code executes fine and 10 columns are created.
Note: I create the information if the array V for debugging. All 11 entries in V are corrrect.
In advance, thanks for the help.
I am having problems with populating 11 columns in my ListBox6.
The following code gives me a Run-Time error 380 "Could not set the List property. Invalid property value." when I am creating column 11 .List(.ListCount - 1, 10) = Me.ListBox5.List(x, 8) . If I were to remove the statement (make it a comment) the code executes fine and 10 columns are created.
Note: I create the information if the array V for debugging. All 11 entries in V are corrrect.
In advance, thanks for the help.
Code:
'// Since .List is 0-based,skip the first row in the listbox //
For x = 1 To Me.ListBox5.ListCount - 1
If ComboBox6.Value = Me.ListBox5.List(x, 0) & "-" & Me.ListBox5.List(x, 8) Then
ReDim V(10)
V(0) = ComboBox8.Value
V(1) = ComboBox5.Value
V(2) = Me.ListBox5.List(x, 0)
V(3) = Me.ListBox5.List(x, 1)
V(4) = Me.ListBox5.List(x, 2)
V(5) = Format(Me.ListBox5.List(x, 3), "00000")
V(6) = Me.ListBox5.List(x, 4)
V(7) = Format(Me.ListBox5.List(x, 5), "mm/dd/yyyy")
V(8) = Format(Me.ListBox5.List(x, 6), "hh:mm AM/PM")
V(9) = Me.ListBox5.List(x, 7)
V(10) = Me.ListBox5.List(x, 8)
With ListBox6
.ColumnCount = 11
.ColumnHeads = False
.ColumnWidths = "15;30;30;100;30;35;55;60;55;100;20"
.AddItem ComboBox8.Value
.List(.ListCount - 1, 1) = ComboBox5.Value
.List(.ListCount - 1, 2) = Me.ListBox5.List(x, 0)
.List(.ListCount - 1, 3) = Me.ListBox5.List(x, 1)
.List(.ListCount - 1, 4) = Me.ListBox5.List(x, 2)
.List(.ListCount - 1, 5) = Format(Me.ListBox5.List(x, 3), "00000")
.List(.ListCount - 1, 6) = Me.ListBox5.List(x, 4)
.List(.ListCount - 1, 7) = Format(Me.ListBox5.List(x, 5), "mm/dd/yyyy")
.List(.ListCount - 1, 8) = Format(Me.ListBox5.List(x, 6), "hh:mm AM/PM")
.List(.ListCount - 1, 9) = Me.ListBox5.List(x, 7)
.List(.ListCount - 1, 10) = Me.ListBox5.List(x, 8)
End With
End If
Next