title: How do you test that a Range in Excel has cells in it?
body: <p>I've found a problem in Excel/VBA in the Worksheet_Change Event.  I need to assign Target.Dependents to a Range, but if it has no dependents it brings up an error.  I tried testing Target.Dependents.Cells.Count but that didn't work.  Any Ideas?</p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  
  If Target.Cells.Count &gt; 1 OR Target.Dependents.Cells.Count = 0 Then Exit Sub
  
  Dim TestRange As Range
  
  Set TestRange = Target.Dependents
  </code></pre>
  
  <p>I've also tried "Target.Dependents Is Nothing".</p>