Tezzies
05-20-2011, 07:47 AM
Hello all,
Slight problem, trying to populate my listbox in a form. as soon I hit .List(.ListCount - 1, 10) = r.Offset(1, 5).Value I get the error "Could not set the list property.Invalid property value". I have set the Column Count to 16 to no avail.
Sub Load()
Dim r As Range
Dim rRange As Range
Set rRange = Range("Progs1R")
For Each r In rRange
If r.Value <> "" Then
With LbxJobs
.AddItem r.Offset(1, 0).Value
.List(.ListCount - 1, 1) = "|"
.List(.ListCount - 1, 2) = r.Offset(1, 1).Value
.List(.ListCount - 1, 3) = "|"
.List(.ListCount - 1, 4) = r.Offset(1, 2).Value
.List(.ListCount - 1, 5) = "|"
.List(.ListCount - 1, 6) = r.Offset(1, 3).Value
.List(.ListCount - 1, 7) = "|"
.List(.ListCount - 1, 8) = r.Offset(1, 4).Value
.List(.ListCount - 1, 9) = "|"
.List(.ListCount - 1, 10) = r.Offset(1, 5).Value
.List(.ListCount - 1, 11) = "|"
.List(.ListCount - 1, 12) = r.Offset(1, 6).Value
End With
End If
Next r
End Sub
Many thanks in advance
Slight problem, trying to populate my listbox in a form. as soon I hit .List(.ListCount - 1, 10) = r.Offset(1, 5).Value I get the error "Could not set the list property.Invalid property value". I have set the Column Count to 16 to no avail.
Sub Load()
Dim r As Range
Dim rRange As Range
Set rRange = Range("Progs1R")
For Each r In rRange
If r.Value <> "" Then
With LbxJobs
.AddItem r.Offset(1, 0).Value
.List(.ListCount - 1, 1) = "|"
.List(.ListCount - 1, 2) = r.Offset(1, 1).Value
.List(.ListCount - 1, 3) = "|"
.List(.ListCount - 1, 4) = r.Offset(1, 2).Value
.List(.ListCount - 1, 5) = "|"
.List(.ListCount - 1, 6) = r.Offset(1, 3).Value
.List(.ListCount - 1, 7) = "|"
.List(.ListCount - 1, 8) = r.Offset(1, 4).Value
.List(.ListCount - 1, 9) = "|"
.List(.ListCount - 1, 10) = r.Offset(1, 5).Value
.List(.ListCount - 1, 11) = "|"
.List(.ListCount - 1, 12) = r.Offset(1, 6).Value
End With
End If
Next r
End Sub
Many thanks in advance