ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What's wrong with this picture (https://www.excelbanter.com/excel-programming/328355-whats-wrong-picture.html)

Jennifer

What's wrong with this picture
 
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
--
Though daily learning, I LOVE EXCEL!
Jennifer

Rob Bovey

What's wrong with this picture
 
"Jennifer" wrote in message
...
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




All times are GMT +1. The time now is 12:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com