I've got a listbox of 11 columns. When I try to add data to one of the columns, I get an error.
ListBox1.Column(10, j) = shtG.Cells(k, 13)
I don't understand why this happens, the listbox on the userform has a ColumnCount of 11.
The error I'm getting:
"Run-time error 380: Unable to set Column property. Invalid property value."
The value of the selected cell is "Group 16".
More info:
Code:
'adding this doesn't help
ListBox1.Clear
ListBox1.ColumnCount = 20
While shtG.Cells(k, 1) <> ""
If 'some long working condition Then
frmTP.ListBox1.AddItem (shtG.Cells(k, kolID))
frmTP.ListBox1.Column(1, j) = shtG.Cells(k, kolVnm) & strSpace & shtG.Cells(k, kolTV) & strSpace & shtG.Cells(k, kolAnm)
frmTP.ListBox1.Column(2, j) = shtG.Cells(k, 5)
frmTP.ListBox1.Column(3, j) = shtG.Cells(k, 6)
frmTP.ListBox1.Column(4, j) = shtG.Cells(k, 7)
frmTP.ListBox1.Column(5, j) = shtG.Cells(k, 8)
frmTP.ListBox1.Column(6, j) = shtG.Cells(k, 9)
frmTP.ListBox1.Column(7, j) = shtG.Cells(k, 10)
frmTP.ListBox1.Column(8, j) = shtG.Cells(k, 11)
frmTP.ListBox1.Column(9, j) = shtG.Cells(k, 12)
frmTP.ListBox1.Column(10, j) = shtG.Cells(k, 13)
j = j + 1
End If
k = k + 1
Wend