View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default sumproduct in VBA

sorry, try it this way
Evaluate("=SUMPRODUCT((D2:D2500=Q3)*(O2:O2500=S1)) ")


--
Don Guillett
SalesAid Software

"ghobbit" wrote in
message ...

Hi Don and Pete

Thanks for your replies

Public Sub CommandButton2_Click()

Cells(3, "S").Value =
Evaluate("=SUMPRODUCT((D2:D2500=range("Q3"))*(O2:O 2500=range("S1")))")

End Sub

gives me a syntax error when I click on the button with the Public Sub
CommandButton2_Click() bit highlighted in yellow

and if I delete the last parentheses it gives me a compile error with
Q3 highlighted saying expected list seperator or ). So I put the
parentheses back only to get the same error.

and as far as I can see there are no typo's

This is really proving quite frustrating because it looks like it
should work and the formula does work if I put it in the cell but I
really dont want to to do this.

any idea?

many thanks for your input

regards

Steve


--
ghobbit
------------------------------------------------------------------------
ghobbit's Profile:
http://www.excelforum.com/member.php...o&userid=12385
View this thread: http://www.excelforum.com/showthread...hreadid=544477