title: Weird data type mismatch error VBA
body: <p>This is to do with ranges and arrays, which I find utterly confusing!</p>
  
  <p>I am reading a range into an array variable as follows:</p>
  
  <pre><code>Output = Range(Results.Cells(2, 1), Results.Cells(2, 100)).Value
  </code></pre>
  
  <p>where <code>Output</code> is a <code>Variant</code> array of size 100, and <code>Results</code> is the name of the worksheet.</p>
  
  <p>I want to pass this array <code>Output</code> as an argument to another sub as follows:</p>
  
  <pre><code>DBUpdate (Output)
  </code></pre>
  
  <p>The <code>DBUpdate</code> sub is defined as:</p>
  
  <pre><code>Sub DBUpdate(Output() as Variant)
  </code></pre>
  
  <p>However, when I run this, I get the following error:</p>
  
  <blockquote>
    <p>Compile error:<br>
    Type mis-match: array or user-defined type expected</p>
  </blockquote>
  
  <p>As I understand, I have defined <code>Output</code> as an array throughout and I have tried everything imaginable to try to overcome this, but failed. Can anyone here point me in the right direction, please?</p>