title: Dynamically Size the Upper Bound of a VBA User Defined Type
body: <p>I'm working with a two-dimensional array that stores a location and date under each iteration. I dynamically set the upper bound of that dimension using a counter variable ("i"), i.e.: </p>
  
  <pre><code>ReDim arrLocDt(1 To i, 0 To 1)
  </code></pre>
  
  <p>When debugging in the Watch window, I always found it cumbersome that I couldn't name the individual items, for example, instead of </p>
  
  <pre><code>arrLocDt(1,0) and arrLocDt(1,1) 
  </code></pre>
  
  <p>I would like to see: </p>
  
  <pre><code>arrLocDt(1,Location), arrLocDt(1,Date), arrLocDt(2,Location), arrLocDt(2,Date), etc.
  </code></pre>
  
  <p>Recently, I learned about <code>User-Define Types</code> which would allow for just such labeling of items. Thus I tried the following:</p>
  
  <p><strong>1. Defined a new UDT</strong></p>
  
  <pre><code>Public Type MyType
  
       strLocation As String
       strDate As String
  
  End Type
  </code></pre>
  
  <p><strong>2. Tried the following definition with a dynamic sizing of the upper bound</strong></p>
  
  <pre><code>Dim test(1 to i) As MyType
  </code></pre>
  
  <p><em>The above failed because I got the error <code>Constant Expression Required</code>.</em> </p>
  
  <p>Please advise how I can dynamically size the upper bound of an UDT, and if that's not possible, an alternative that would still allow me to label my items. </p>