title: Troubleshoot printing macro
body: <p>So with the help of the Stack Overflow community some time back, I created a printing macro for a worksheet that would read the worksheet and only print the number of pages that had information in it. It would read certain sections of rows and if not data had been entered, would print the correct number of pages. This allowed the user to just input the data and hit the print button to print the correct number of pages (rather than selecting File..Print...etc)  </p>
  
  <p>Here is the code that was used:</p>
  
  <pre><code>Sub LastRowInOneColumn()
  
      Dim MySheet As Worksheet
      Set MySheet = Worksheets("SIF Sheet")
  
      With MySheet
  
          Dim xLastRow As Long
          xLastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
  
          Select Case True
  
              Case xLastRow &gt; 21 And xLastRow &lt; 46
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=1, Preview:=True
  
              Case xLastRow &gt; 46 And xLastRow &lt; 97
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=2, Preview:=True
  
              Case xLastRow &gt; 98 And xLastRow &lt; 149
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=3, Preview:=True
  
              Case xLastRow &gt; 150 And xLastRow &lt; 201
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=4, Preview:=True
  
              Case xLastRow &gt; 202 And xLastRow &lt; 253
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=5, Preview:=True
  
              Case xLastRow &gt; 254 And xLastRow &lt; 305
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=6, Preview:=True
  
              Case xLastRow &gt; 306 And xLastRow &lt; 357
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=7, Preview:=True
  
              Case xLastRow &gt; 358 And xLastRow &lt; 409
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=8, Preview:=True
  
              Case xLastRow &gt; 410 And xLastRow &lt; 461
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=9, Preview:=True
  
              Case xLastRow &gt; 462 And xLastRow &lt; 513
  
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut From:=1, To:=10, Preview:=True
  
          End Select
  
      End With
  
  End Sub
  </code></pre>
  
  <p>This was fine as the data that was being entered was in sections (1 account per section) however we recently have had to redesign it so it is no longer in sections. The way it is now<br>
  <a href="https://i.stack.imgur.com/JU8QM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JU8QM.jpg" alt="Example Picture"></a></p>
  
  <p>What I need help with is a script that will check row by row for data, infinitely and then print when it comes to the first row with no data, only those pages that have data. </p>
  
  <p>Hope this makes sense.     </p>
  
  <p>I also found this bit of code so now I am super confused by which one I was using. </p>
  
  <pre><code>Sub LastRowInOneColumn()            
      If Range("C19") = "Enter any special posting instruction here." Then
          Range("C19:I26").ClearContents
      End If
  
      Dim MySheet As Worksheet
      Set MySheet = Worksheets("SIF Sheet")
  
      With MySheet
          Dim xLastRow As Long
          xLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
  
          Select Case True
              Case xLastRow &lt; 500
                  'Application.Dialogs(xlDialogPrinterSetup).Show
                  Worksheets("SIF Sheet").PrintOut
          End Select
      End With    
  End Sub
  </code></pre>
  
  <p>The part I need the most help with is this:
  The issue they are having is that say they enter information on lines 1-200, then delete the information on lines 175-200, it is still printing through 200, rather than through 175</p>