title: Delphi - Excel: Define a non-contiguous range
body: <p>What I have is a sheet with data and I want to define a non-contiguous range that can be used to, as an example, create a chart.</p>
  
  <p>As long as the range is rectangular it's pretty easy defining the range.</p>
  
  <pre><code>range := ASheet.Range['A1', 'B10'];
  </code></pre>
  
  <p>This creates a rectangular range with the top left corner at <code>A1</code> and bottom right corner in <code>B10</code>. The problem is when the data isn't defined so that it can be selected with a single rectangle. </p>
  
  <p>As an example we have this data:</p>
  
  <pre><code>+-------+------+------+------+------+
  | Time  | Col1 | Col2 | Col3 | Col4 |
  +-------+------+------+------+------+
  | 01:20 |    5 |    1 |  101 |   51 |
  | 01:21 |    6 |    1 |  101 |   51 |
  | 01:22 |    5 |    0 |  101 |   51 |
  | 01:23 |    5 |    0 |  101 |   51 |
  | 01:24 |    5 |    0 |  101 |   55 |
  | 01:25 |    5 |    1 |  101 |   55 |
  | 01:26 |    6 |    1 |  101 |   15 |
  | 01:27 |    7 |    2 |  101 |   15 |
  | 01:28 |    7 |    2 |  101 |   15 |
  +-------+------+------+------+------+
  </code></pre>
  
  <p>If I for example wish to create a chart for <em>Time, Col1 and Col2</em> then the range is simply <code>ASheet.Range['A1', 'C10']</code>. If I want to create the chart for <em>Time, Col1, Col3 and Col4</em> it's not possible to create a range this way (since Col2 shouldn't be included).</p>
  
  <p>In VBA it's possible to create the desired range by simply <code>.Range("A1:B10,D1:E10")</code>. Unfortunately there doesn't seem to be an equivalent way of defining a range in Delphi (Excel2010), in fact it seems to only support range with the format <code>.Range[topLeft, bottomRight]</code>.</p>
  
  <p><strong>My question is:</strong> How do I define a non-contiguous range in Delphi?</p>