title: VBA Object doesn't support this property or method
body: <p>I need to simply count the number of areas on a sheet.  The code I have is :</p>
  
  <pre><code>Sub areas()
     Dim i As Long
     i = Worksheets("Sheet2").Selection.Areas.Count
     MsgBox i
  End Sub
  </code></pre>
  
  <p>But for some reason I get the error message "Object doesn't support this property or method." I have no idea why. This code was basically just copied from the Microsoft website. </p>
  
  <p>I can't even get the immediate window to print the <code>Worksheets("Sheet2").Selection.Areas.Count</code> portion.</p>
  
  <p>Any quick help? I am using Excel 2010.</p>
  
  <p>Thanks.</p>