What's wrong with this picture

G

Guest

Ok this doesn't work unless the producedata is active. WHY? Just when I
thought I was getting this!
Sub UpdateInvoiceList()
With Worksheets("ProduceData")
..Range("Invoice").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"q2"), Unique:=True
..Range("InvoiceList").Sort Key1:=Sheets("ProduceData").Range("q3")
End With

End Sub
 
R

Rob Bovey

Jennifer said:
Ok this doesn't work unless the producedata is active. WHY? Just when I
thought I was getting this!
Sub UpdateInvoiceList()
With Worksheets("ProduceData")
.Range("Invoice").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"q2"), Unique:=True
.Range("InvoiceList").Sort Key1:=Sheets("ProduceData").Range("q3")
End With

End Sub

Hi Jennifer,

You have an unqualified Range method call in the CopyToRange argument of
the AdvancedFilter method. If Range("q2") refers to a cell located on the
ProduceData worksheet, simply placing a dot in front of Range("q2") will
solve the problem.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top