title: How to combine ranges in VBA?
body: <p>I have a form that I have developed in Excel and added a command button to print the form.  There are four pages to the form, but if the first cell of the second or third pages of the cell are blank, I want to skip those pages.  I have come up with the following code, but i get an "Type Mismatch" error as it combines the ranges. Is this not an appropriate way to combine ranges/ is there a better way?</p>
  
  <pre><code>Private Sub PrintAuth1_Click()
  '   Prints the Authorization Form upon clicking once
  
  Dim printrng As Range   'Range to be printed so that blank pages are not printed.
      Set printrng = Worksheets("BLR 13210").Range("A1:AX69")
  Dim ws As Worksheet
      Set ws = ActiveSheet
  
  If ws.Range("E75") &lt;&gt; "" Then   'If first line of this page is blank, then it won't print the page
      printrng = printrng &amp; ws.Range("A70:AX135")
  End If
  If ws.Range("E141") &lt;&gt; "" Then  'If first line of this page is blank, then it won't print the page
      printrng = printrng &amp; ws.Range("A136:AX200")
  End If
  
  printrng = printrng &amp; ws.Range("A201:AX264")    'Adds last page to print range
  
  ' Dialog Box to decide whether to quick print or make changes to printer setup.
  msg = "Would you like to send to default printer?"
  msg = msg &amp; vbNewLine
  config = vbYesNoCancel + vbQuestion + vbDefaultButton1
  Title = "Printer Selection"
  ans = MsgBox(msg, config, Title)
  
  If ans = vbYes Then printrng.PrintOut Copies:=1, Collate:=True
  If ans = vbNo Then Application.Dialogs(xlDialogPrint).Show
  If ans = vbCancel Then
  End If
  
  End Sub 
  </code></pre>