help in syntax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to write the following formula into cell.

.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(COUNTIF("&rRange & "," & sCell&")>1,TRUE,FALSE)"

where rRange and sCell are range variables.
I got syntax error.
Would anyone help?

Thanks in advance.
 
Hi
I think this will work.

..FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(COUNTIF(rRange , sCell)>1,TRUE,FALSE)"


Regards
Andrew Bourke
 
You don't give us much help, but assuming that rRange is a range variable
and sCell is a string variable setup earlier in the code, you could try

.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(COUNTIF(" & rRange.Address & ",""" & sCell &
""")>1,TRUE,FALSE)"

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top