VBA AdvancedFilter problem using different workbooks

JAD0816

New Member
Joined
Sep 30, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
.AdvancedFilter works great if the .range data to filter and the .range criteria list are both within the same workbook.

.AdvancedFilter does not seem to work if the .range data to filter is located in one open workbook, and the .range criteria data to filter is in a different open workbook. For example:

This works (same workbook, different sheets):

ThisWorkbook.Sheets("Sheet1").Range("A1:G25").AdvancedFilter xlFilterInPlace, ThisWorkbook.Sheets("Sheet2").Range("I1:I5")

This also works (same workbook, different sheets):

OtherWorkbook.Worksheets.Sheets("Sheet1").Range("A1:G25").AdvancedFilter xlFilterInPlace, OtherWorkbook.Worksheets.Sheets("Sheet2").Range("I1:I5")

This does not work (different workbooks):

ThisWorkbook.Sheets("Sheet1").Range("A1:G25").AdvancedFilter xlFilterInPlace, OtherWorkbook.Worksheets.Sheets("Sheet2").Range("I1:I5")

Run-time error '1004':
This formula is missing a range reference or a defined name.

Any solutions?
 
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,214,827
Messages
6,121,824
Members
449,050
Latest member
Bradel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top