title: How to reference and refresh a QueryTable in Excel 2016 in VBA
body: <p>I'm trying to refresh a query on a cell change, however I can't figure out how to reference the query.</p>
  
  <p>My code: <code>Sheets("Roster Query").QueryTables(0).Refresh</code></p>
  
  <p>Just errors out with: </p>
  
  <blockquote>
    <p>Run-time error '1004':</p>
    
    <p>Application-defined or object-defined error</p>
  </blockquote>
  
  <p>I have a sheet named "Roster Filter" that has  query table I want to refresh. How can I get that QueryTable and refresh it?</p>
  
  <p>Edit: Also tried:</p>
  
  <pre><code>For Each qt In Sheets("Roster Query").QueryTables
      qt.Refresh
  Next
  </code></pre>
  
  <p>This does not error out, but the query is not refreshed.</p>