Applying Sumproduct Formula to Cell via VBA Failing

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to find a VBA solution to using the countif function with a closed workbook. With reference to this post, I have attempted to to do this. My attempt is failing, with a #NAME error in the destination cell.
Here is the line of code I'm using to apply the formular to the cell.

Code:
.Cells(1, 30) = "=SUMPRODUCT(('D:\WSOP 2020\[permit_data.xlsx]Activity_Default'!$E2:$E2000=str_func)+0)"

Any suggestions on where I have gone wrong?
 
str_func = "BaseballWMBARepMosquito (U10/U11)"

This value exists in cell E11, so I am expecting a return value of 1.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Ok, add the extra quotes like
VBA Code:
$E2:$E2000=""" & str_func & """)
 
Upvote 0
OK ... I have it working now. Thanks for your patience Fluff!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,558
Messages
6,125,504
Members
449,235
Latest member
Terra0013

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