title: How to return an array of two arrays in VBA function
body: <p>I like to have a function returning two arrays, each array 
  composed of many small fixed size (2) arrays.</p>
  
  <pre><code>function AssbIO(...) as variant()
  '...
  Dim i() as variant
  Dim o() as variant
  Redim i(0 to 1) 
  Redim o(0 to 1) 
  
  i(0)(0)=1
  i(0)(1)=2
  
  i(1)(0)=3
  i(1)(1)=4
  
  o(0)(0)=11
  o(0)(1)=22
  
  o(1)(0)=33
  o(1)(1)=44
  
  'Now the following is giving me an error
  AssbIO(0) = i
  AssbIO(1) = o
  
  End Function
  </code></pre>
  
  <p>Your help would be appreciated.</p>
  
  <p>PS. Here is the full Program i am trying to achieve
  Given a series of i and o, i want to construct a series
  of i's (from 1 to 4, then from 7 to 9...)
  and of o's (from 5 to 6, then from 10 to 15)
  Example: IO=("i","i","i","o","o","i")
  then i=((1,3),(6,6)) and o=((4,5))</p>
  
  <pre><code>Function AssbIO(IO() As String) As Variant
  
  Dim i() As Variant
  Dim o() As Variant
  Dim ni As Integer 'the jumper of i()
  Dim no As Integer 'the jumper of o()
  Dim nIO As Integer ' the jumper of initial IO()
  Dim a As Integer, b As Integer 
  a = 1
  
  While nIO &lt;= erLen(IO)
    b = a 
  
    While IO(nIO) = "i"
     b = b + 1
     nIO = nIO + 1
    Wend
  
      ni = ni + 1
      ReDim Preserve i(0 To ni - 1)
      i(ni - 1)(0) = a
      i(ni - 1)(1) = b
      a = b + 1
  
    While IO(nIO) = "o"
     b = b + 1
     nIO = nIO + 1
    Wend
  
      no = no + 1
      ReDim Preserve o(0 To no - 1)
      o(no - 1)(0) = a
      o(no - 1)(1) = b
      a = b + 1
  
   While IO(nIO) &lt;&gt; "i" And IO(nIO) &lt;&gt; "n"
   nIO = nIO + 1
   Wend
  
  Wend
  
  'ReDim AssbIO(0 To 1) 'this is giving me errors
  AssbIO(0) = i
  AssbIO(1) = o
  
  End Function
  </code></pre>