Gruppe
Druck
Problem
Vor dem Ausdruck sollen vor die erste und nach der letzten Zelle mit Fettdruck neue Zeilen eingefügt werden. Start über die normale Drucken-Schaltfläche oder über das Menü Druck.
ClassModule: DieseArbeitsmappe
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim iFirst As Integer, iSecond As Integer, iRow As Integer
iRow = 1
Do Until IsEmpty(Cells(iRow, 1))
If Cells(iRow, 1).Font.Bold = True Then
If iFirst = 0 Then iFirst = iRow
Else
If iFirst > 0 Then
iSecond = iRow
Exit Do
End If
End If
iRow = iRow + 1
Loop
Rows(iSecond).Insert
With Cells(iSecond, 1)
.Value = "Nach den fetten Zeilen"
.Font.Bold = False
End With
Rows(iFirst).Insert
Cells(iFirst, 1).Value = "Vor den fetten Zeilen"
End Sub