Why an error?

M

Mike

Hi. Can you tell me why I am getting an error with the
following statement? If I take the same formula and plug
it into the worksheet, it works fine.


Range("C9").Formula = "=SUMPRODUCT(--(Dec!A6:A20>J3),--
(Dec!A6:A20<K3),--(Dec!B6:B20<>""))"

Thanks,
Mike.
 
J

J.E. McGimpsey

Just as in XL, in VBA, quotation marks inside strings need to be
doubled:

Range("C9").Formula = "=SUMPRODUCT(--(Dec!A6:A20>J3),--
(Dec!A6:A20<K3),--(Dec!B6:B20<>""""))"


(all on one line).
 
M

Mike

Thanks for your help!
-----Original Message-----
Just as in XL, in VBA, quotation marks inside strings need to be
doubled:

Range("C9").Formula = "=SUMPRODUCT(--(Dec! A6:A20>J3),--
(Dec!A6:A20<K3),--(Dec!B6:B20<>""""))"


(all on one line).



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top