quotation marks for excel function criteria (1 Viewer)

alktrigger

Aimless Extraordinaire
Local time
Today, 04:59
Joined
Jun 9, 2009
Messages
124
i'm trying to automate the excel function =COUNTIF(D2:D48, "> 0") in my vb code, but how do I work around the quotation marks in the criteria field?

Code:
strCell2 = "= COUNTIF(" & strChar(o)& "2:"& strChar(o) & (intRecordNumber - 1)  & ", [COLOR=Red]"> 0"[/COLOR] )"
 

SOS

Registered Lunatic
Local time
Today, 01:59
Joined
Aug 27, 2008
Messages
3,514
Use single quotes for the red part.
 

alktrigger

Aimless Extraordinaire
Local time
Today, 04:59
Joined
Jun 9, 2009
Messages
124
can you show me exactly what you're talking about, because trying this is causing Run-time error 1004.

here is what i changed it to.
Code:
strFormula2 = "= COUNTIF(" & strChar(o) & "2:" & strChar(o) &_
        (intRecordNumber - 1) & ",[COLOR=Red]' >0 '[/COLOR])"
 

SOS

Registered Lunatic
Local time
Today, 01:59
Joined
Aug 27, 2008
Messages
3,514
I had meant what you had, but since it is giving you a problem, try it this way:

strFormula2 = "= COUNTIF(" & strChar(o) & "2:" & strChar(o) &_
(intRecordNumber - 1) & "," & Chr(34) & ">0" & Chr(34) & ")"
 

Users who are viewing this thread

Top Bottom