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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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,029
Messages
6,122,760
Members
449,095
Latest member
m_smith_solihull

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