Sumproduct in VBA linking to external (opened) workbooks

alexisremen

New Member
Joined
Nov 15, 2021
Messages
3
Office Version
  1. 2016
Hi,

I have this piece of code:

VBA Code:
With Workbooks("MyWorkbook.xlsx").Worksheets("MyWorksheet")
   Workbooks("OtherWorkbook.xlsb").Worksheets("OtherWorksheet").Cells(i, "MR").Value2 = _
   .Evaluate("SUMPRODUCT((W2:W150000=MYRANGE)*Z2:Z150000,AA2:AA150000)")
End With

The code seems to work if I refer to any range in MyWorksheet instead of using MYRANGE. What I want is to put a reference to another workbook where it says MYRANGE. That other workbook will be open. Any idea how to do this?

Thanks!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,226,481
Messages
6,191,263
Members
453,650
Latest member
EKwitz

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