title: VBA - Class vs Type for Memory Optimization
body: <p>Experts out there - quick question...</p>
  
  <p>In Excel VBA, I have created a class which holds 4 string variables - No constructor and nothing else.</p>
  
  <p>Now, in my code, I am looping through an ENORMOUS array (100k + iterations) 
  Constantly creating a new instance of the class, assigning values to its variables, using it then assigning it toMyClass = nothing. Then looping again:</p>
  
  <pre><code>Dim x As New MyClass
  Set x = Nothing
  
  For i = 0 to 1000000
     x.Var1 = "XYZ"
     x.Var2 = "abc"
     x.Var3 = "123"
     x.Var4 = 456
  
  ... Use x ...
  
  Set x = Nothing
  
  Next i
  </code></pre>
  
  <p>Given this usage, would it be more memory efficient to define x as a class or as a public type (or doesn't it really make a difference)??</p>
  
  <p>Thanks!!</p>