das Makro durchsucht Bereiche und blendet Zeilen aus, wenn in Spalte C die Zellen leer sind um dann das Blatt zu drucken.
Sub print_n()
Dim iCol As Integer
Dim i As Integer
Dim iRow As Integer
Dim iRowL As Integer
Dim i2 As Integer
Dim iRow2 As Integer
Dim iRowL2 As Integer
iCol = 3
iRow = 34 '1. Bereich
iRowL = 38
iRow2 = 40 '2. Bereich
iRowL2 = 44
For i = iRow To iRowL
If Cells(i, iCol) = 0 Then Rows(i).EntireRow.Hidden = True
If Cells(i, iCol) = 0 Then Rows(i + 1).EntireRow.Hidden = True
Next
For i2 = iRow2 To iRowL2
If Cells(i2, iCol) = 0 Then Rows(i2).EntireRow.Hidden = True
If Cells(i2, iCol) = 0 Then Rows(i2 + 1).EntireRow.Hidden = True
Next
'Drucken
For i = iRow To iRowL + 1
If Rows(i).Hidden = True Then Rows(i).EntireRow.Hidden = False
Next
For i2 = iRow2 To iRowL2 + 1
If Rows(i2).Hidden = True Then Rows(i2).EntireRow.Hidden = False
Next
End Sub
Das Makro ist eine optische Katastrophe und sehr langsam.Weis jemand wie man das Makro optimieren kann?
Vorab vielen Dank. Grüße chandler