Why an error?

  • Thread starter Thread starter Mike
  • Start date Start date
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.
 
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).
 
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).



.
 
Back
Top