Gegroet,
Info over de bijlage: Klik op lege cel in kolomA = UserForm1
Dubbelklik op NIET-lege cel in kolomA = UserForm2
Het probleem stelt zich in Uform2.
Dit loopt goed tot kolom 11 van de ListBox moet gevuld worden, dan verschijnt een foutmelding.
In de rode regel loopt het vast.
Iemand dit de fout weet?
Bekijk bijlage (2)Uform tonen bij selectionchange.xlsm
Info over de bijlage: Klik op lege cel in kolomA = UserForm1
Dubbelklik op NIET-lege cel in kolomA = UserForm2
Het probleem stelt zich in Uform2.
Dit loopt goed tot kolom 11 van de ListBox moet gevuld worden, dan verschijnt een foutmelding.
In de rode regel loopt het vast.
Code:
Private Sub CommandButton1_Click()
With ListBox1
.Clear
.ColumnCount = 15
.ColumnWidths = "70;70;70;70;70;70;70;70;70;70;70;70;70;70;70"
.ColumnHeads = False
End With
With Sheets(1)
Rij = .Range("A" & .Rows.Count).End(xlUp).Row
For r = 2 To Rij
If .Cells(r, 2).Value = ComboBox2.Value Then
ListBox1.AddItem .Cells(r, 1).Value
ListBox1.List(s, 1) = .Cells(r, 2).Value
ListBox1.List(s, 2) = .Cells(r, 3).Value
ListBox1.List(s, 3) = .Cells(r, 4).Value
ListBox1.List(s, 4) = .Cells(r, 5).Value
ListBox1.List(s, 5) = .Cells(r, 6).Value
ListBox1.List(s, 6) = .Cells(r, 7).Value
ListBox1.List(s, 7) = .Cells(r, 8).Value
ListBox1.List(s, 8) = .Cells(r, 9).Value
ListBox1.List(s, 9) = .Cells(r, 10).Value
[COLOR="#FF0000"]'ListBox1.List(s, 10) = .Cells(r, 11).Value[/COLOR]
s = s + 1
End If
Next r
End With
End Sub
Bekijk bijlage (2)Uform tonen bij selectionchange.xlsm