title: Advanced Filter to copy data to another workbook
body: <p>I have a Workbook with a search interface on one Worksheet and a database on another Worksheet.
  this is the code I use to do an Advanced Filter on the database which returns the values on the search interface worksheet:</p>
  <pre><code>Private Sub Find_Click()
      Sheet2.Range(&quot;A1&quot;).CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
      CriteriaRange:=Sheet4.Range(&quot;V1:AE2&quot;), CopyToRange:=Sheet4.Range(&quot;E1:T1&quot;), Unique:=False
  End Sub
  </code></pre>
  <p>I am now trying to split the 2 worksheets into 2 workbooks. So the Advanced Filter would be performed on the data contained in Workbook &quot;Data&quot; and the results returned to the Workbook &quot;SearchInterface&quot;.
  The 2 workbooks would always be opened at the same time.</p>
  <p>I tried inserting variables:</p>
  <pre><code>Private Sub Find_Click()
      Set wbSearch = ThisWorkbook
      Set wbData = Workbooks(&quot;GAL_db.xlsx&quot;)
      
          wbData.Sheet2.Range(&quot;A1&quot;).CurrentRegion.AdvancedFilter Action:=xlFilterCopy,
          CriteriaRange:=wbSearch.Sheet4.Range(&quot;V1:AE2&quot;), CopyToRange:=wbSearch.Sheet4.Range(&quot;E1:T1&quot;), Unique:=False
  
  End Sub
  </code></pre>
  <p>Getting Syntax Error on</p>
  <pre><code>wbData.Sheet2.Range(&quot;A1&quot;).CurrentRegion.AdvancedFilter Action:=xlFilterCopy
  </code></pre>
  <p>I tried many things but nothing works. Not being too knowledgeable, I'm pretty much shooting in the dark. Any help or direction would be greatly appreciated.</p>
  <p><strong>==UPDATE===</strong></p>
  <p>thanks for the input Rory!
  I changed the code as suggested to this:</p>
  <pre><code>Private Sub Find_Click()
      Set wbData = Workbooks(&quot;GAL_db.xlsx&quot;)
      
          wbData.Sheets(&quot;Sheet2&quot;).Range(&quot;A1&quot;).CurrentRegion.AdvancedFilter Action:=xlFilterCopy,
          CriteriaRange:=Sheet4.Range(&quot;V1:AE2&quot;), CopyToRange:=Sheet4.Range(&quot;E1:T1&quot;), Unique:=False
  
  End Sub
  </code></pre>
  <p>Now I'm getting again a syntax error with:</p>
  <pre><code>wbData.Sheets(&quot;Sheet2&quot;).Range(&quot;A1&quot;).CurrentRegion.AdvancedFilter Action:=xlFilterCopy,
  </code></pre>
  <p>and <code>Private Sub Find_Click()</code> is highlighted in yellow...</p>