title: Excel VBA - Get the values of UserForm Label Caption Property
body: <p>I have a UserForm with labels and textboxes.  I want to loop through the Lables, get the value of their Caption property and enter that value as my column headers.</p>
  
  <p>Here is a snip of my code:</p>
  
  <pre><code>Dim element As Control
  
      For Each element In WQTR_Form.Controls
          If TypeName(element) = "Label" Then
              For Each Cell In Range.Rows(1).Cells
                  Cells.Value = ***Label.caption***
              Next Cell
          End If
       Next element
  </code></pre>
  
  <p>What I'm trying to figure out is how to get <code>***Lable.Caption***</code>.  </p>
  
  <p>I tried <code>element.Caption</code> but the autocomplete list does not show Caption as a property for element because in the current context element is of the type Controls.  What I need is how to get the value of Type Label.Caption for every Label on my form.</p>
  
  <p>Of course, my entire approach may be wrong!  If you have a suggestion of another way to do this please tell me.  Thanks in advance for your help.</p>
  
  <p><strong>UPDATE:*</strong></p>
  
  <p>First off thanks for all your answers.  Now, I'm having other weirdness.  I mentioned it in response to Kostas K's comment below but I want to add it to the question.  I'm getting a compile error "Variable Not Defined" for <code>Cell</code> in <code>For Each Cell in Range.Rows(1).Cells</code>.  </p>
  
  <p>So, being a total novice I tried adding <code>Dim Cell as Range</code>.  then I get a compile error that says the argument is not optional for <code>Range</code> in <code>For Each Cell in Range.Rows(1).Cells</code>.  Maybe that second erro is a result of adding the Dim?  Maybe that whole line of code is just wrong!????</p>
  
  <p>I have thought about trying something like <code>For Each Cell in Range("A1":Z1)</code> but it that seems to defeat the purpose of <code>Rows(1).Cells</code>.</p>