title: How to modify a Form.Control using a "Partially Qualified" name in a String
body: <p>I've been trying to solve this issue, off and on, for a couple of months without success. Unfortunately, I have been unable to find any documentation, information, or discussions that address the question at hand.</P>
  I have three <code>Sub-Routines</code> that are essentially identical to the one below hard coded with the <code>Partially Qualified Label Name</code>, i.e. <code>&quot;Label's Name</code> without the <code>Index</code>. </P></p>
  <pre><code>Sub lblToggle2(ByRef lblYr As Long)
   Dim i
   Dim lblcnt As Long
      If Not lblYr = 0 Then
          lblcnt = wbCurYear - lblYr + 1
          Debug.Print lblYr, lblcnt
          For i = 1 To lblcnt
              Me.Controls(&quot;lblCostYrE&quot; &amp; i).Caption = lblYr
              Me.Controls(&quot;lblCostYrG&quot; &amp; i).Caption = lblYr
              lblYr = lblYr + 1
          Next i
        Else
          For i = 1 To 5
              Me.Controls(&quot;lblCostYrE&quot; &amp; i).Caption = vbNullString
              Me.Controls(&quot;lblCostYrG&quot; &amp; i).Caption = vbNullString
          Next i
      End If
  End Sub
  </code></pre>
  <p>The sub above is based in part on <a href="https://stackoverflow.com/a/20677557/18701211">This Link</a> and is called using:</p>
  <pre><code>Call lblToggle2(StartYear)
  </code></pre>
  <p>What I am trying to accomplish is basically <code>Code Reduction</code> thereby allowing me to use one <code>Sub</code> to handle multiple <code>Label</code> combinations.</P>
  Here are two of the several attempts to make this work (all of which failed)!</P>
  Calling Code:</p>
  <pre><code>  Call lblToggleTest1(StartYear, &quot;&quot;&quot;lblCostYrG&quot;&quot;&quot;, &quot;&quot;&quot;lblCostYrE&quot;&quot;&quot;)
    Call lblToggleTest2(StartYear, &quot;&quot;&quot;lblCostYrG&quot;&quot;&quot;, &quot;&quot;&quot;lblCostYrE&quot;&quot;&quot;)
  </code></pre>
  <p>And <code>Sub-Routine Code</code></p>
  <pre><code>Sub lblToggleTest1(ByRef lblYr As Long, lblG As String, lblE As String)
   Dim i
   Dim lblcnt As Long
   
      If Not lblYr = 0 Then
          lblcnt = wbCurYear - lblYr + 1
          For i = 1 To lblcnt
          Debug.Print lblYr, cntrl1.Name, cntrl2.Name, lblcnt
              Me.Controls(lblG).Caption = lblYr
              Me.Controls(lblE).Caption = lblYr
              lblYr = lblYr + 1
          Next i
        Else
          For i = 1 To 5
              Me.Controls(lblG).Caption = vbNullString
              Me.Controls(lblE).Caption = vbNullString
          Next i
      End If
  End Sub
  
  Sub lblToggleTest2(ByRef lblYr As Long, lblG As String, lblE As String)
   Dim i
   Dim lblcnt As Long
   Dim cntrl1 As Object
   Dim cntrl2 As Object
   cntrl1 = lblG &amp; (i)
   cntrl2 = lblE &amp; (i)
   
      If Not lblYr = 0 Then
          lblcnt = wbCurYear - lblYr + 1
          For i = 1 To lblcnt
          Debug.Print lblYr, cntrl1.Name, cntrl2.Name, lblcnt
              Me.Controls(cntrl1).Caption = lblYr
              Me.Controls(cntrl2).Caption = lblYr
              lblYr = lblYr + 1
          Next i
        Else
          For i = 1 To 5
              Me.Controls(cntrl1).Caption = vbNullString
              Me.Controls(cntrl2).Caption = vbNullString
          Next i
      End If
  End Sub
  </code></pre>
  <p>I have tried declaring the <code>Label</code> variables as <code>Variant</code>, <code>Object</code>, and <code>String</code>. No matter what I try, I get <code>Object Not Found</code>, <code>Object Required</code>, or some other error!</P>
  I'm sure it's something simple that I am missing, but I have been scratching my head for so long trying to figure this out that I ma starting to go bald!</P>
  Could someone please help/point me in the right direction?
  Thank you in advance for your assistance.</p>