Also diese Zeile ist dafr das in eine Zelle die ich automatisch erzeugen lasse automatische eine laufende Nr. eingetragen wird und so wie du das gesagt hast stimmt es auch so wolte ich das, aber bei mir macht der wenn ich das in Zeile 6 mache , das Ganze mit A9 am Ende aus.
Das ist der Code den ich nutze:
Private
Sub
CommandButton3_Click()
Dim
i
As
Long
, Zeile
As
Long
Dim
Abteilung
As
String
, Name
As
String
Dim
LfdNr
As
Integer
Dim
Blatt
As
Worksheet
For
Each
Blatt
In
ActiveWorkbook.Sheets
Blatt.Unprotect (
"KdoSAN"
)
Next
Zeile = Application.InputBox(
"nach welcher Zeile einfuegen?"
,
"Zeile einfuegen"
, 0, Type:=1)
If
Zeile = 0
Then
Exit
Sub
Application.EnableEvents =
False
Abteilung = Application.InputBox(
"Abtl."
,
"Abt. einfuegen"
, Type:=2)
Name = Application.InputBox(
"Name"
,
"Name eintragen"
, Type:=2)
Nummer =
"=ZEILEN($A$5:"
& Range(
"A"
& ActiveCell.Row).Address(0, 0) &
")"
For
i = ActiveSheet.Index
To
Worksheets.Count
With
Worksheets(i)
.Rows(Zeile).Insert xlDown
.Cells(Zeile, 1) = Nummer
.Cells(Zeile, 2) = Abteilung
.Cells(Zeile, 3) = Name
End
With
Next
Application.EnableEvents =
True
End
Sub