title: VBA Excel page break at change in cell to every worksheet in the workbook
body: <p>I have some code to add a page break at a change in cell contents, however I am unable to get it to run for more than the active sheet. I have about 80 sheets I need to run this on and need it to run at the same time. I have tried running it on ThisWorkbook, but it doesn't work. It will work great on a sheet by sheet basis, but not on the entire workbook.</p>
  
  <pre><code>Option Explicit
  
  Sub Set_PageBreaks()
  
      Dim lastrow As Long, c As Range
  
      lastrow = Cells(Rows.Count, "B").End(xlUp).Row
  
      Application.ScreenUpdating = False
  
      For Each c In Range("A2:A" &amp; lastrow)
          If c.Offset(1, 0).Value &lt;&gt; c.Value And c.Offset(1, 0) &lt;&gt; "" Then
              c.Offset(1, 0).PageBreak = xlPageBreakManual
          End If
      Next c
  
      Application.ScreenUpdating = True
  
  End Sub
  </code></pre>