title: Creating variables within a loop
body: <p>I'm working in VBA and I wanted to know if it was possible to create and name variables within a while loop.  My goal is to look through a particular column in the worksheet and create variables whose values are the text within the cells of that column.</p>
  
  <p>Ideally, the variable names and their values would be something along the lines of:</p>
  
  <pre><code>party1 = "Owner" 
  party2 = "Contractor" 
  party3 = "Subcontractor"
  </code></pre>
  
  <p>And so on a so forth based on an number of parties.</p>
  
  <p>So far I have:</p>
  
  <pre><code>Dim i As Integer, j As Integer
  i = 2
  j = 1
  Do While Cells(i, 7).Value &lt;&gt; ""
      Dim partyName As String
      ' Pulls the text from the worksheet cell
      partyName = Cells(i, 7).Text
      Dim curNum As String
      curNum = CStr(j)
      Dim tempParty As String
      tempParty = "party" &amp; curNum
      i = i + 1
      j = j + 1
  Loop
  </code></pre>
  
  <p>I think this comes down to the question: How do I then get partyX to be the variable name and the variable value to be the string stored in partyName?</p>
  
  <p><a href="http://www.ozgrid.com/forum/showthread.php?t=51017" rel="nofollow">This</a> seems like it's along the lines of what I'm looking for, but it doesn't quite answer my question.  Also, I recognize there may be issues with the scope of these variables, but I can't think of any other way to do this.</p>