title: excel vba check if command button and checkbox exists
body: <p>I have a script that uses checkboxes and command buttons, and there is a macro that resets them to default on every sheet.</p>
  
  <pre><code>'opt button reset
      For i = 1 To Worksheets.Count
  Sheets(i).Shapes("Option Button 1").ControlFormat.Value = xlOn
      Next i
  
  'cb reset
  For i = 1 To Worksheets.Count
      Sheets(i).Shapes("CheckBox1").ControlFormat.Value = xlOff
  Next i
  </code></pre>
  
  <p>The problem is that, if there is a sheet that has no checkbox or opt button, the script does not work</p>
  
  <p>What I want to do is to check if the cb and ob exists and execute the script only than. </p>
  
  <p>Thanks in advance</p>