title: Test if range exists in VBA
body: <p>I have a dynamically defined named range in my excel ss that grabs data out of a table based on a start date and an end date like this</p>
  
  <pre><code>=OFFSET(Time!$A$1,IFERROR(MATCH(Date_Range_Start,AllDates,0)-1,MATCH(Date_Range_Start,AllDates)),1,MATCH(Date_Range_End,AllDates)-IFERROR(MATCH(Date_Range_Start,AllDates,0)-1,MATCH(Date_Range_Start,AllDates)),4)
  </code></pre>
  
  <p>But if the date range has no data in the table, the range doesn't exists (or something, idk). How can I write code in VBA to test if this range exists or not?</p>
  
  <p>I have tried something like</p>
  
  <pre><code>If Not Range("DateRangeData") Is Nothing Then
  </code></pre>
  
  <p>but I get "Runtime error 1004, method 'Range' of object '_Global' failed."</p>