View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default IF formula syntax problem

Hi Stephen,

Try
ActiveCell.Formula = "=IF(C2=""Y"",1,0)"

Regards,
Stefi


€˛Stephen€¯ ezt Ć*rta:

Hi folks,

I'm trying to get my code to insert an IF formula into a cell...

Range("D2").Select
ActiveCell.Formula = "=IF(C2='Y',1,0)"

but I keep getting an object-defined error. I've tried variations of quotes
and parens. but the best I am able to come up with is having it populate the
formula as a string. What am I missing?

Thanks.