ich komme mal wieder nicht weiter und benötige eure Hilfe.
Ich fülle die Listbox mit:
Private Sub UserForm_Initialize()
Dim iZeile As Long, i As Integer
Dim iCounter As Long: iCounter = 0
With ListBox1
.ColumnCount = 11
.ColumnWidths = "3,2cm;3,2cm;3cm;2,5cm;2,5cm;3cm;2,5cm;2,5cm;2,5cm;2,5cm;2,5cm"
.Clear
End With
With Worksheets("Lehrer")
For iZeile = 1 To .Cells(Rows.Count, 1).End(xlUp).Row
' If .Cells(iZeile, 5) = 0 Then
If iCounter = 0 Then
ReDim ar(12, iCounter)
Else
ReDim Preserve ar(12, iCounter)
End If
For i = 0 To 11
ar(i, iCounter) = .Cells(iZeile, i + 1)
Next i
ar(12, iCounter) = iZeile
iCounter = iCounter + 1
' End If
Next iZeile
ListBox1.List = Application.Transpose(ar)
End With
End Sub
Ich bringe es leider nicht zustande das Löschen des Eintrags zu erstellen.
Bis jetzt gelingt es mir nur die Werte der einzelnen Zellen zu löschen:
Private Sub CommandButton8_Click()
Dim iZeile As Long
Dim ar As Variant, i As Integer
ar = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
With Worksheets("Lehrer")
For i = 0 To UBound(ar)
.Cells(ListBox1.List(ListBox1.ListIndex, 12), ar(i)) = "" 'Controls("TextBox" & ar(i))
ListBox1.List(ListBox1.ListIndex, ar(i) - 1) = Controls("TextBox" & ar(i))
Next i
End With
End Sub
Was muss ich bitte eintragen, um die ganze Zeile zu löschen.
Besten Dank für eure Hilfe.
Gruss
Peter