Private
Sub
CommandButton4_Click()
Dim
OldRow
As
Variant
, Indx
As
Integer
Dim
OldRow1, RowCnt, Zeile
As
Variant
On
Error
GoTo
0
For
Each
Blatt
In
ActiveWorkbook.Sheets
Blatt.Unprotect (
"KdoSAN"
)
Next
Indx = ActiveSheet.Index
OldRow = Selection.Address(0)
RowCnt = Selection.Rows.Count
Selection.
Select
If
InStr(OldRow,
":"
) = 0
Then
MsgBox
"Keine ganze Zeile ausgewählt"
& vbLf &
"Zeile zuerst bitte selektieren"
:
Exit
Sub
Zeile = Application.InputBox(
"in welche Zeile verschieben?"
,
"Zeile "
& OldRow &
" verschieben"
, Type:=1)
If
Zeile = Empty
Then
Exit
Sub
On
Error
GoTo
Fehler
Application.ScreenUpdating =
False
Application.EnableEvents =
False
OldRow1 = Left(OldRow, InStr(OldRow,
":"
) - 1)
If
Zeile > OldRow1
Then
Zeile = Zeile + RowCnt + 1
For
i = ActiveSheet.Index
To
Worksheets.Count
With
Worksheets(i)
.
Select
.Rows(OldRow).Cut
.Rows(Zeile).Insert shift:=xlDown
End
With
Next
Fehler:
Worksheets(Indx).
Select
Application.EnableEvents =
True
If
Err > 0
Then
MsgBox
"unerwarteter Fehler"
& vbLf &
Error
()
End
Sub