Hello everyone,
I'd like to seek for everyone's assistance why am I getting this error message:
"Could not set the list property. Invalid property value error"
I have no problem with populating the listbox1 inside a form using the code below but whenever I try to modify the listbox, the said error is happening.
Initialize
Textbox Change
Any insight is appreciated.
I'd like to seek for everyone's assistance why am I getting this error message:
"Could not set the list property. Invalid property value error"
I have no problem with populating the listbox1 inside a form using the code below but whenever I try to modify the listbox, the said error is happening.
Initialize
Code:
UserForm_Initialize()
Dim x As Integer
y = 3
Do Until Sheets("List").Cells(y, 1) = ""
y = y + 1
Loop
y = y - 1
UsrReport.ListBox1.ColumnWidths = "50;120;85"
For x = 3 To y
With UsrReport.ListBox1
.AddItem
.List(x - 3, 0) = Sheet2.Cells(x, 1)
.List(x - 3, 1) = Sheet2.Cells(x, 3) & ", " & Sheet2.Cells(x, 2)
.List(x - 3, 2) = Sheet2.Cells(x, 5)
.List(x - 3, 3) = Sheet2.Cells(x, 6)
End With
Next x
End Sub
Textbox Change
Code:
Sub cbJobGrade_Change()
UsrReport.ListBox1.Clear
For x = 3 To y
If Sheet2.Cells(x, 6).Value = UsrReport.cbJobGrade.Value Then
With UsrReport.ListBox1
.AddItem
.List(x - 3, 0) = Sheet2.Cells(x, 1)
.List(x - 3, 1) = Sheet2.Cells(x, 3) & ", " & Sheet2.Cells(x, 2)
.List(x - 3, 2) = Sheet2.Cells(x, 5)
.List(x - 3, 3) = Sheet2.Cells(x, 6)
End With
Else
End If
Next x
End Sub
Any insight is appreciated.