#1   Report Post  
Lift Off
 
Posts: n/a
Default =if(and(....


I have this formula in a spread sheet that works fine:

=IF(AND(J2=0,F20),"NO",IF(AND(J2=1,F20),"YES",'' ))

I'm trying to put it into a macro but it won't compile. I've written
the macro thus:

With Range ("H2")
Range(.Cells(0, 1), .End(xlDown)).Offset(0, 3).FormulaR1C1 = _
"=IF(AND(RC[-1]=0,RC[-5]0),"NO",IF(AND(RC[-1]=1,RC[-5]0),"YES",""))"
End With

What have I done wrong?

Thanks


--
Lift Off
------------------------------------------------------------------------
Lift Off's Profile: http://www.excelforum.com/member.php...fo&userid=8249
View this thread: http://www.excelforum.com/showthread...hreadid=482087

  #2   Report Post  
duane
 
Posts: n/a
Default =if(and(....


try this - seemed to work for me - note you need double "" everwhere

Sub macro1()
With Range("H2")
Range(.Cells(0, 1), .End(xlDown)).Offset(0, 3). _
FormulaR1C1 =
"=IF(AND(RC[-1]=0,RC[-5]0),""NO"",IF(AND(RC[-1]=1,RC[-5]0),""YES"",""""))"
End With
End Sub


--
duane


------------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=482087

  #3   Report Post  
Lift Off
 
Posts: n/a
Default =if(and(....


Duane:

That's it! I NEVER would have found that solution. What's the rule on
this double quote thing?

Many thanks for taking the time.

Cliff


--
Lift Off
------------------------------------------------------------------------
Lift Off's Profile: http://www.excelforum.com/member.php...fo&userid=8249
View this thread: http://www.excelforum.com/showthread...hreadid=482087

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
=if(and ?? MyKool Excel Discussion (Misc queries) 4 October 18th 05 12:45 PM


All times are GMT +1. The time now is 01:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"