Hi
I have two columns on which I want to run a sumproduct formula using
VBA. Column D has names and column O has what I want to match it with.
I have two cells containing the information for the criteria namely Q3
= John and S1 = AGREE. I would like the result put into S2
I want to run this using a command button rather than have the formula
in the cell.
If I put this formula into the cell S2 then it works fine
=SUMPRODUCT((D2:D2500=Q3)*(O2:O2500=S1))
However if I create a button and have this code, I get a #Value error
in S3 instead of the result
Private Sub CommandButton2_Click()
Cells(3, "S").value =
Evaluate("=SUMPRODUCT((D2:D2500=Q3)*(O2:02500=S1)) ")
End Sub
If I leave out the evaluate and just have
Cells(3, "S").value =SUMPRODUCT((D2:D2500=Q3)*(O2:02500=S1))
then I get a syntax error
Is there anything obvious I'm doing wrong??
many thanks
Steve
--
ghobbit
------------------------------------------------------------------------
ghobbit's Profile:
http://www.excelforum.com/member.php...o&userid=12385
View this thread:
http://www.excelforum.com/showthread...hreadid=544477