Run-time error 1004

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an additional problem

Range("Substrate1").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"A2:A3"), CopyToRange:=Range("AA5"), Unique:=False 'Filters and exports
Substrate1 data

Gives Gives "Application-defined or object-defined error

Dave Peterson wrote

If your code is behind a worksheet, then Range("S1") refers to the sheet with
that code--not the Substrate1 worksheet.

application.goto worksheets("substrate1").range("s1"), scroll:=true

should work
 
Try specifying the worksheet that owns the criteria range and the copytorange.

....criteriarange:=worksheets("sheet9999").range("a2:A3"), _
copytorange:=worksheets("sheet8888").range("aa5"), ...

I used two different fake names. You may not want those.
 
It is hard to follow your problem. Next timne list the code as it actually
appears along with your comments.

I think you problem is Substrate is a worksheet, not a range. If you want
to select the entire worksheet use the following

Sheets("Substrate1").Cells.Select

Advance filter must have a range object, not just a worksheet.
Range("Substrate1").AdvancedFilter Action:=xlFilterCopy,


You can do thjis to select the entire worksheet
Sheets("Substrate1").Cells.Select
Selection.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range( _
"A2:A3"), CopyToRange:=Range("AA5"), Unique:=False
 

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

Back
Top