Option
Explicit
Option
Compare Text
Private
Sub
CommandButton1_Click()
Dim
l0Zeile
As
Long
l0Zeile = 10
Do
While
Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value)) <>
""
l0Zeile = l0Zeile + 1
Loop
Tabelle2.Cells(l0Zeile, 2) =
CStr
(
"Neuer Eintrag Zeile "
& l0Zeile)
ListBox1.AddItem
CStr
(
"Neuer Eintrag Zeile "
& l0Zeile)
ListBox1.ListIndex = ListBox1.ListCount - 1
End
Sub
Private
Sub
CommandButton3_Click()
Dim
l0Zeile
As
Long
Dim
l8Zeile
As
Long
If
ListBox1.ListIndex = -10
Then
Exit
Sub
If
ListBox1.ListIndex = -18
Then
Exit
Sub
l0Zeile = 10
Do
While
Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value)) <>
""
l8Zeile = 18
Do
While
Trim(
CStr
(Tabelle2.Cells(l8Zeile, 2).Value)) <>
""
If
ListBox1.Text = Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value))
Then
If
ListBox1.Text = Trim(
CStr
(Tabelle2.Cells(l8Zeile, 2).Value))
Then
Tabelle2.Rows(
CStr
(l0Zeile &
":"
& l0Zeile)).Delete
Tabelle2.Rows(
CStr
(l8Zeile &
":"
& l8Zeile)).Delete
Call
UserForm_Initialize
If
ListBox1.ListCount > 0
Then
ListBox1.ListIndex = 0
Call
UserForm_Initialize
If
ListBox1.ListCount > 0
Then
ListBox1.ListIndex = 0
Exit
Do
End
If
l0Zeile = l0Zeile + 1
l8Zeile = l8Zeile + 1
Loop
End
Sub
Private
Sub
CommandButton2_Click()
Dim
l0Zeile
As
Long
If
ListBox1.ListIndex = -1
Then
Exit
Sub
If
Trim(
CStr
(TextBox1.Text)) =
""
Then
MsgBox
"Sie müssen mindestens einen Namen eingeben!"
, vbCritical + vbOKOnly,
"FEHLER!"
Exit
Sub
End
If
l0Zeile = 10
Do
While
Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value)) <>
""
If
ListBox1.Text = Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value))
Then
Tabelle2.Cells(l0Zeile, 1).Value = Trim(
CStr
(TextBox1.Text))
Tabelle2.Cells(10, 2).Value = TextBox16.Text
Tabelle2.Cells(10, 3).Value = TextBox15.Text
Tabelle2.Cells(10, 4).Value = TextBox12.Text
Tabelle2.Cells(10, 5).Value = TextBox14.Text
Tabelle2.Cells(10, 6).Value = TextBox7.Text
Tabelle2.Cells(10, 7).Value = TextBox13.Text
Tabelle2.Cells(10, 8).Value = TextBox6.Text
Tabelle2.Cells(10, 9).Value = TextBox11.Text
Tabelle2.Cells(10, 11).Value = TextBox5.Text
Tabelle2.Cells(10, 12).Value = TextBox10.Text
Tabelle2.Cells(10, 13).Value = TextBox4.Text
Tabelle2.Cells(10, 14).Value = TextBox9.Text
Tabelle2.Cells(10, 15).Value = TextBox3.Text
Tabelle2.Cells(18, 1).Value = TextBox8.Text
Tabelle2.Cells(18, 2).Value = TextBox2.Text
Tabelle2.Cells(18, 3).Value = TextBox23.Text
Tabelle2.Cells(18, 4).Value = TextBox22.Text
Tabelle2.Cells(18, 5).Value = TextBox21.Text
Tabelle2.Cells(18, 6).Value = TextBox20.Text
Tabelle2.Cells(18, 7).Value = TextBox19.Text
Tabelle2.Cells(18, 8).Value = TextBox18.Text
Tabelle2.Cells(18, 9).Value = TextBox17.Text
Tabelle2.Cells(18, 10).Value = TextBox29.Text
Tabelle2.Cells(18, 11).Value = TextBox28.Text
Tabelle2.Cells(18, 12).Value = TextBox27.Text
Tabelle2.Cells(18, 13).Value = TextBox26.Text
Tabelle2.Cells(18, 14).Value = TextBox25.Text
Tabelle2.Cells(18, 15).Value = TextBox32.Text
Tabelle2.Cells(18, 16).Value = TextBox31.Text
If
ListBox1.Text <> Trim(
CStr
(TextBox1.Text))
Then
Call
UserForm_Initialize
If
ListBox1.ListCount > 0
Then
ListBox1.ListIndex = 0
End
If
Exit
Do
End
If
l0Zeile = l0Zeile + 1
Loop
End
Sub
Private
Sub
CommandButton4_Click()
Unload
Me
End
Sub
Private
Sub
ListBox1_Click()
Dim
l0Zeile
As
Long
TextBox1 =
""
TextBox16 =
""
TextBox15 =
""
TextBox12 =
""
TextBox14 =
""
TextBox7 =
""
TextBox13 =
""
TextBox6 =
""
TextBox11 =
""
TextBox5 =
""
TextBox10 =
""
TextBox4 =
""
TextBox9 =
""
TextBox3 =
""
TextBox8 =
""
TextBox2 =
""
TextBox23 =
""
TextBox22 =
""
TextBox21 =
""
TextBox20 =
""
TextBox19 =
""
TextBox18 =
""
TextBox17 =
""
TextBox29 =
""
TextBox28 =
""
TextBox27 =
""
TextBox26 =
""
TextBox25 =
""
TextBox32 =
""
TextBox31 =
""
If
ListBox1.ListIndex >= 0
Then
l0Zeile = 10
Do
While
Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value)) <>
""
If
ListBox1.Text = Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value))
Then
TextBox1 = Trim(
CStr
(Tabelle2.Cells(l0Zeile, 1).Value))
TextBox16 = Tabelle2.Cells(l0Zeile, 2).Value
TextBox15 = Tabelle2.Cells(l0Zeile, 3).Value
TextBox12 = Tabelle2.Cells(l0Zeile, 4).Value
TextBox14 = Tabelle2.Cells(l0Zeile, 5).Value
TextBox7 = Tabelle2.Cells(l0Zeile, 6).Value
TextBox13 = Tabelle2.Cells(l0Zeile, 7).Value
TextBox6 = Tabelle2.Cells(l0Zeile, 8).Value
TextBox11 = Tabelle2.Cells(l0Zeile, 9).Value
TextBox5 = Tabelle2.Cells(l0Zeile, 10).Value
TextBox10 = Tabelle2.Cells(l0Zeile, 11).Value
TextBox4 = Tabelle2.Cells(l0Zeile, 12).Value
TextBox9 = Tabelle2.Cells(l0Zeile, 13).Value
TextBox3 = Tabelle2.Cells(l0Zeile, 14).Value
TextBox8 = Tabelle2.Cells(18, 1).Value
TextBox2 = Tabelle2.Cells(18, 2).Value
TextBox23 = Tabelle2.Cells(18, 3).Value
TextBox22 = Tabelle2.Cells(18, 4).Value
TextBox21 = Tabelle2.Cells(18, 5).Value
TextBox20 = Tabelle2.Cells(18, 6).Value
TextBox19 = Tabelle2.Cells(18, 7).Value
TextBox18 = Tabelle2.Cells(18, 8).Value
TextBox17 = Tabelle2.Cells(18, 9).Value
TextBox29 = Tabelle2.Cells(18, 10).Value
TextBox28 = Tabelle2.Cells(18, 11).Value
TextBox27 = Tabelle2.Cells(18, 12).Value
TextBox26 = Tabelle2.Cells(18, 13).Value
TextBox25 = Tabelle2.Cells(18, 14).Value
TextBox32 = Tabelle2.Cells(18, 15).Value
TextBox31 = Tabelle2.Cells(18, 16).Value
Exit
Do
End
If
l0Zeile = l0Zeile + 1
Loop
End
If
End
Sub
Private
Sub
UserForm_Activate()
If
ListBox1.ListCount > 0
Then
ListBox1.ListIndex = 0
End
Sub
Private
Sub
UserForm_Initialize()
Dim
l0Zeile
As
Long
TextBox1 =
""
TextBox16 =
""
TextBox15 =
""
TextBox12 =
""
TextBox14 =
""
TextBox7 =
""
TextBox13 =
""
TextBox6 =
""
TextBox11 =
""
TextBox5 =
""
TextBox10 =
""
TextBox4 =
""
TextBox9 =
""
TextBox3 =
""
TextBox8 =
""
TextBox2 =
""
TextBox23 =
""
TextBox22 =
""
TextBox21 =
""
TextBox20 =
""
TextBox19 =
""
TextBox18 =
""
TextBox17 =
""
TextBox29 =
""
TextBox28 =
""
TextBox27 =
""
TextBox26 =
""
TextBox25 =
""
TextBox32 =
""
TextBox31 =
""
ListBox1.Clear
l0Zeile = 10
Do
While
Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value)) <>
""
ListBox1.AddItem Trim(
CStr
(Tabelle2.Cells(l0Zeile, 2).Value))
l0Zeile = l0Zeile + 1
Loop
End
Sub