SUMIF CODE

E

ezil

What is wrong with this statement it igves "expected end of statement" error
msg.

sub abc()
pos=15
Range(Cells(3, 2), Cells(pos, 2)) = "=SUMIF(A2:A5,">10")"
end sub
 
S

Simon Lloyd

If you dont want the >10 in quotes the

Code
-------------------
Range(Cells(3, 2), Cells(pos, 2)).Value = "=SUMIF(A2:A5,>10)

-------------------
however if you do the

Code
-------------------

Range(Cells(3, 2), Cells(pos, 2)).Value = "=SUMIF(A2:A5," & Chr(34) & ">10" & Chr(34) & ")

-------------------

--
Simon Lloy

Regards
Simon Lloy
'The Code Cage' (http://www.thecodecage.com
 
D

Dave Peterson

Double up the double quotes in strings in your VBA code:

Range(Cells(3, 2), Cells(pos, 2)) = "=SUMIF(A2:A5,"">10"")"
 
Top