Private
Sub
CommandButton4_Click()
Dim
zelleA
Dim
Cell
As
Range
zelleA = Application.InputBox(Prompt:=
"Vor welcher Zeile soll ein neues Thema angelegt werden?"
, Title:=
"Zellenauswahl"
, Type:=1)
If
zelleA =
""
Then
Exit
Sub
Application.CutCopyMode =
False
For
i = 0
To
4
Sheets(
"Übersicht"
).Cells(zelleA + i, 1).EntireRow.Insert
i = i + 1
Next
Sheets(
"nicht verändern"
).Rows(
"5:10"
).Copy Destination:=Sheets(
"Übersicht"
).Rows(zelleA)
For
Each
Cell
In
Sheets(
"nicht verändern"
).Rows(
"5:10"
)
Call
CopyPasteFormatCondition(Cell, Sheets(
"Übersicht"
).Cells(Cell.Row, Cell.Column))
Next
End
Sub
Sub
CopyPasteFormatCondition(
ByVal
RngCopy
As
Range,
ByVal
RngPaste
As
Range)
Dim
formCond
As
FormatConditions
Dim
i
As
Integer
, j
As
Integer
Set
formCond = RngCopy.FormatConditions
RngPaste.FormatConditions.Delete
For
i = 1
To
formCond.Count
With
RngPaste.FormatConditions
If
formCond(i).Type = 1
Then
If
formCond(i).Operator < 3
Then
.Add formCond(i).Type, formCond(i).Operator, formCond(i).Formula1, formCond(i).Formula2
Else
: .Add formCond(i).Type, formCond(i).Operator, formCond(i).Formula1
End
If
Else
: .Add formCond(i).Type, , formCond(i).Formula1
End
If
With
.Item(i)
For
j = 1
To
formCond(i).Borders.Count
With
.Borders(j)
.Color = formCond(i).Borders(j).Color
.LineStyle = formCond(i).Borders(j).LineStyle
End
With
Next
j
With
.Font
.Bold = formCond(i).Font.Bold
.Color = formCond(i).Font.Color
.FontStyle = formCond(i).Font.FontStyle
.Italic = formCond(i).Font.Italic
.Strikethrough = formCond(i).Font.Strikethrough
.Underline = formCond(i).Font.Underline
End
With
With
.Interior
.Color = formCond(i).Interior.Color
.PatternColor = formCond(i).Interior.PatternColor
.Pattern = formCond(i).Interior.Pattern
End
With
End
With
End
With
Next
i
End
Sub