title: Font of all the controls in VBA Userform using For loop
body: <p><a href="https://i.stack.imgur.com/Oi2W4.jpg" rel="nofollow noreferrer">The sample userform</a></p>
  
  <p>All I want is, when I press a button, the font of all the controls is changed to a desired value. I wrote this for a <code>commandbutton</code>like below and it works fine for it.</p>
  
  <pre><code>Private Sub CommandButton2_Click()
  CommandButton2.Font = "Arial"
  End Sub
  </code></pre>
  
  <p>This works fine. But when I try to use the for loop for the same application, I get error. The snippet in which I get error is </p>
  
  <pre><code>Private Sub CommandButton2_Click()
  Dim x As Control
  CommandButton2.Font = "Arial"
  For Each x In Me.Controls
      x.Font = "Arial"
  Next
  End Sub
  </code></pre>
  
  <p>The error: </p>
  
  <blockquote>
    <p>'438: Object doesn't support this property or method'. </p>
  </blockquote>
  
  <p>Any help will be greatly appreciated.</p>