Is there a way to count all filled rows and/or cells between two PageBreaks defined manually?
And how can I set a macro to delete the last PageBreak defined manually?
My intention is to correct a problem in this code (used to fix a spreadsheet for printing), which can waste some space between the last two pages:
Sub Macro2()
Dim Linha As Integer
Dim MarcaFinal As Integer
Cells.Select
Cells.EntireRow.AutoFit
Cells.PageBreak = xlPageBreakNone
Linha = 50
MarcaFinal = 0
Line1:
If MarcaFinal = 48 Then
GoTo LineFim
End If
If Mid(Cells(Linha, 4), 1, 3) = "aaa" Then
Worksheets("Plan4").Rows(Linha).PageBreak = xlPageBreakManual
Linha = Linha + 49
MarcaFinal = 0
GoTo Line1
Else
Linha = Linha - 1
MarcaFinal = MarcaFinal + 1
GoTo Line1
End If
LineFim:
MsgBox "Clique aqui."
End Sub
And how can I set a macro to delete the last PageBreak defined manually?
My intention is to correct a problem in this code (used to fix a spreadsheet for printing), which can waste some space between the last two pages:
Sub Macro2()
Dim Linha As Integer
Dim MarcaFinal As Integer
Cells.Select
Cells.EntireRow.AutoFit
Cells.PageBreak = xlPageBreakNone
Linha = 50
MarcaFinal = 0
Line1:
If MarcaFinal = 48 Then
GoTo LineFim
End If
If Mid(Cells(Linha, 4), 1, 3) = "aaa" Then
Worksheets("Plan4").Rows(Linha).PageBreak = xlPageBreakManual
Linha = Linha + 49
MarcaFinal = 0
GoTo Line1
Else
Linha = Linha - 1
MarcaFinal = MarcaFinal + 1
GoTo Line1
End If
LineFim:
MsgBox "Clique aqui."
End Sub