![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Colombia
Posts: 339
|
In the following macro I am getting 1004 error (Failure in Advanced Filter Method of Range Class). I have been told that for Advanced Filter your ranges must be in the same workbook, and that you can avoid this situation using named ranges, as in my case, where criteria and "copy to" ranges are in a workbook (Disp_Dem.xls in OF worksheet), and data range is in another workbook (Trabajo.xls).
Here is my code. Sub Cons_Ord() ' ' Order Filter ' Workbooks("Disp_Dem").Activate Worksheets("OF").Select Range("Crit_Lanz").Select Range("Trabajo.xls!Datos_lanz").AdvancedFilter Action:=xlFilterCopy, _ CriteriaRange:=Range("Disp_Dem.xls!Crit_Lanz"), CopyToRange:=Range("Disp_Dem.xls!Rango_Lanz"), Unique:=False End Sub Any suggestions in order to avoid this error?. Thanks in advance. |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,065
|
error 1004 is common, i guess down to the named ranges that refer to in VBA, this error is conflict of some kind..
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|