• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

AutoFill

Derek McGill

Active Member
Hi all.
When I try to AutoFill

Range("P2").Formula = "=SUMPRODUCT((O1:O111 <> "")/COUNTIF(O1:O111,O1:O111 & ""))"
It removes 2 of the "'s Ie:-
=SUMPRODUCT((O1:O111 <> ")/COUNTIF(O1:O111,O1:O111 & "))

Any help on how to fix this ?
 
Hi, Derek McGill!

Try this:
Range("P2").Formula = "=SUMPRODUCT((O1:O111 <> """")/COUNTIF(O1:O111,O1:O111 & """"))"

Since you're assigning a string (that contains a formula, but a string at last), you have to embed it in quotes. And if the inner string (aka the formula) uses quotes, they should be doubled so as to be considered as a single character in the assignment.

Regards!
 
Back
Top