title: check if a range is empty in vba module
body: <p>I wanted to check if an excel range in empty in a section of code in user module.
  I used the below code</p>
  
  <pre><code>Worksheets(yearsheet).Range("N" &amp; rownum &amp; ":DI").Select
  If Application.WorksheetFunction.CountA(Selection) = 0 Then
      Exit Sub
  End If
  </code></pre>
  
  <p>I'm getting runtime error 1004. Can anyone tell whats my mistake?</p>
  
  <p>Thanks in advance.
  PS: rownum is integer variable and yearsheet is string variable. both these variables were updated properly in code prior to the above section of the code</p>