title: How to select a range of cells using two variables in VBA
body: <p>I would like to use:</p>
  
  <pre><code>    Set rng1 = .Range("A1")
      Set rng2 = .Range("C3")
  </code></pre>
  
  <p>as discussed in this <a href="https://stackoverflow.com/questions/12527725/how-to-create-a-range-from-2-ranges-in-vba">link</a>. The OP had cell A1 and cell C3 as two separate one-cell ranges. He asked how to change the range so that all cells in between them are also included in a new bigger range. My issue is similar, but my cell range changes with each new scenario. Example #1 start date in cell D1 and end date in cell Y1, new range is D1:Y1; or example #2 start date in cell B1 and end date in cell AZ1, new range is B1:AZ1. How can I change the above code so that a variable can be used instead of a static range?</p>