Sub
CommandButton1_Click()
Dim
loIndex
As
Long
, raTreffer
As
Range, loLetzte
As
Long
For
loIndex = 0
To
Me
.ListBox1.ListCount - 1
If
Me
.ListBox1.Selected(loIndex)
Then
With
Worksheets(
"Aufzeichnung"
)
Set
raTreffer = .Columns(2).Find(what:=
Me
.ListBox1.List(loIndex), LookIn:=xlValues, LookAt:=xlWhole)
If
Not
raTreffer
Is
Nothing
Then
If
.Cells(raTreffer.Row + 29, 2) =
""
Then
loLetzte = .Cells(raTreffer.Row + 30, 2).
End
(xlUp).Offset(1).Row
.Cells(loLetzte, 1) =
CDate
(
Me
.TextBox1)
.Cells(loLetzte, 2) =
Me
.ListBox2
.Cells(loLetzte, 3) =
Me
.TextBox3
.Cells(loLetzte, 5) =
Me
.TextBox4
Else
MsgBox
"Eintrag unter der Liste "
&
Me
.ListBox1.List(loIndex) &
" nicht möglich,"
_
& vbLf &
"diese Liste ist voll."
End
If
End
If
Set
raTreffer =
Nothing
End
With
End
If
Next
loIndex
Set
raTreffer =
Nothing
End
Sub