title: Use of Custom Data Types in VBA
body: <p>I am trying to create a custom data type in VBA for Excel. Let's call this data type "truck". Each truck has the following attributes:</p>
  
  <pre><code>NumberOfAxles (this is an integer)
  AxleWeights (this is an array of doubles)
  AxleSpacings (this is an array of doubles)
  </code></pre>
  
  <p>Can I create many instances of the data type "truck" (truck(1), truck(2)... etc), and read/write the attributes I listed above to that instance?</p>
  
  <p>Example:</p>
  
  <pre><code>Truck(1).NumberOfAxles = 2
  Truck(1).AxleWeights(1) = 15.0
  Truck(1).AxleWeights(2) = 30.0
  Truck(1).AxleSpacings(1) = 8.0
  
  Truck(2).NumberOfAxles = 3
  Truck(2).AxleWeights(1) = 8.0
  Truck(2).AxleWeights(2) = 10.0
  Truck(2).AxleWeights(3) = 12.0
  Truck(2).AxleSpacings(1) = 20.0
  Truck(2).AxleSpacings(2) = 4.0
  </code></pre>
  
  <p>and so on. The syntax above is most possibly wrong, I just wanted to demonstrate the structure I need to come up with. </p>
  
  <p>All I am trying to write data to a data structure and call it as necessary such as</p>
  
  <pre><code>Truck(i).NumberOfAxles
  Truck(i).AxleWeights(j)
  Truck(i).AxleSpacings(j)
  </code></pre>
  
  <p>Thank you very much!</p>