Option
Explicit
Private
Sub
CommandButton1_Click()
Dim
lZeile
As
Long
lZeile = 2
Do
While
LTrim(
CStr
(Tabelle1.Cells(lZeile, 1).Value)) >
""
lZeile = lZeile + 1
Loop
Tabelle1.Cells(lZeile, 1) =
CStr
(lZeile) - 1
Call
ÄAnummer(ThisWorkbook.Worksheets(
"Tabelle1"
))
ListBox1.AddItem
CStr
(lZeile) - 1
ListBox1.ListIndex = ListBox1.ListCount - 1
CheckBox5.Enabled =
True
CheckBox3.Enabled =
True
CheckBox4.Enabled =
True
TextBox11.Enabled =
True
TextBox13.Enabled =
True
TextBox15.Enabled =
True
If
TextBox11.Text =
""
Then
TextBox15.Text =
"-"
ElseIf
TextBox11.Value =
True
Then
TextBox15.Text =
""
End
If
End
Sub
Sub
ÄAnummer(
ByRef
wks
As
Excel.Range)
Dim
ÄANr
As
Long
Dim
Jahr
As
Integer
Dim
intLZ
As
Long
Dim
intCol
As
Integer
Dim
NextZ
Dim
Next
ÄANr
With
wks
Jahr = .Cells(2, 31)
ÄANr = .Cells(2, 32)
If
Jahr <> Year(
Date
)
Then
ÄANr = 0
Jahr = Year(
Date
)
.Cells(2, 31) = Jahr
End
If
ÄANr = ÄANr + 1
.Cells(2, 32) = ÄANr
Next
ÄANr =
"ÄA_"
& Jahr &
"_"
& ÄANr
intCol = 4
NextZ = .Cells(Rows.Count, intCol).
End
(xlUp).Row
.Range(
"D"
& NextZ + 1).Value =
Next
ÄANr
NextZ = NextZ + 1
End
With
End
Sub