Neither can the script for creating "inseparable signatures" work. This is the range of lines that should be on a single sheet when printing.

I have a book, there are several sheets in it, there are ranges in the sheets of the following type:

  • Podpis0
  • Podpis1
  • Podpis2
  • etc.

I need to write a script that will automatically iterate through all ranges and put hyphenation in the right places.

Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.ResetAllPageBreaks For Each Nm In ActiveWorkbook.Names If Left(Nm, 6) = "Podpis" Then Dim R As Range Set R = Range(Nm) Set R = R.Offset(-1, 0).Resize(R.Rows.Count + 1, R.Columns.Count) R.Rows.PageBreak = xlPageBreakNone For Each Rw In R.Rows If Rw.PageBreak = xlPageBreakAutomatic Then R.Rows.PageBreak = xlPageBreakManual End If Next End If Next Nm End Sub 

It turned out something like that. But he, for some reason does not work.

    1 answer 1

    In places where you had to use the name of the range ( Left(Nm, 6) and Range(Nm) ), you just had to use Nm.Name .