I have a UserForm with a ListBox with 3 columns, the first column is filled on Initialization by an array. The 2nd and 3rd column are left empty. On selection, an inputbox is called via a function, to input and verify a number which I need in the second column. I've tried this with the List
property but I get the error
Run-Time error '380':
Could not set the List property. Invalid property value.
Here is the sub which manipulates the Listbox:
Private Sub lstKarren_Change()
Dim i As Long
Dim karName As String
With Me.lstKarren
For i = 0 To .ListCount - 1
If .Selected(i) And Not Karren(i) Then
Karren(i) = True
.List(i, 1) = numValInput
ElseIf Not .Selected(i) And Karren(i) Then
Karren(i) = False
.List(i, 1) = Empty
End If
Next i
End With
End Sub
The debugger highlights the line:
.list(i, 1) = numValInput 'numValInput is function which returns a number as a string.
The code runs fine the moment I change it to .List(i)
but then it changes the first column, not the second column. The information I found says the List
property should do the trick to set the 2nd column but I fail to understand why I get the run-time error.