Re: Syntax Problem with formula code

From: Todd Huttenstine (anonymous_at_discussions.microsoft.com)
Date: 05/10/04


Date: Mon, 10 May 2004 09:11:30 -0700

Ah that did the trick. Thank you both for your help.

Now what determines when I use the R1C1 option? I have
always used it thinking that was just how it was.

Todd
>-----Original Message-----
>Todd,
>
>Change
>
>ActiveCell.FormulaR1C1
>
>to
>
>ActiveCell.Formula
>
>B6 is not an RC type address.
>
>HTH,
>Bernie
>MS Excel MVP
>
>"Todd Htutenstine" <anonymous@discussions.microsoft.com>
wrote in message
>news:addb01c436a7$37fecba0$a501280a@phx.gbl...
>> I doubled quoted everything and now its putting single
>> quotes around my cell addresses and that is causing my
>> formula to come up with the NAME error.
>>
>> I put this in the VBA code and VBA likes this:
>> ActiveCell.FormulaR1C1 = "=IF(AND(B6<>"""",E6<>"""")
>> =TRUE,IF(B6="""",,) & IF(B6<>"""",B6&"" - 1YR"",) & IF
>> (E6="""",,) & IF(E6<>"""",""; ""&E6&"" - 2YR"",),IF
>> (B6="""",,) & IF(B6<>"""",B6&"" - 1YR"",) & IF
(E6="""",,)
>> & IF(E6<>"""",E6&"" - 2YR"",))"
>>
>> However when I run the code it puts the following in the
>> cell:
>> =IF(AND('B6'<>"",'E6'<>"")=TRUE,IF('B6'="",,) & IF
>> ('B6'<>"",'B6'&" - 1YR",) & IF('E6'="",,) & IF
>> ('E6'<>"","; "&'E6'&" - 2YR",),IF('B6'="",,) & IF
>> ('B6'<>"",'B6'&" - 1YR",) & IF('E6'="",,) & IF
>> ('E6'<>"",'E6'&" - 2YR",))
>>
>> I need for it to put this formula in the cell instead:
>> =IF(AND(B6<>"",E6<>"")=TRUE,IF(B6="",,) & IF
(B6<>"",B6&" -
>> 1YR",) & IF(E6="",,) & IF(E6<>"","; "&E6&" - 2YR",),IF
>> (B6="",,) & IF(B6<>"",B6&" - 1YR",) & IF(E6="",,) & IF
>> (E6<>"",E6&" - 2YR",))
>>
>>
>> >-----Original Message-----
>> >Double the double quotes, e.g.:
>> >
>> > ...AND(B6<>"""",E6<>"""")=TRUE,...
>> >
>> >
>> >In article <aa9101c436a3$31849c40$a401280a@phx.gbl>,
>> > "Todd Huttenstine"
<anonymous@discussions.microsoft.com>
>> wrote:
>> >
>> >> Hey guys below is a line of code in my project. In
the
>> >> VBE it is showing up in red because it does not like
>> >> the "" within the formula. I know the format to
enter
>> the
>> >> formula in the cell is correct because I have used
the
>> >> same format on other occasions. Its just so many of
>> >> the "" is messing it up. How do I correct this?
>> >>
>> >> ActiveCell.FormulaR1C1 = "=IF(AND(B6<>"",E6<>"")
=TRUE,IF
>> >> (B6="",,) & IF(B6<>"",B6&" - 1YR",) & IF(E6="",,) &
IF
>> >> (E6<>"","; "&E6&" - 2YR",),IF(B6="",,) & IF
>> (B6<>"",B6&" -
>> >> 1YR",) & IF(E6="",,) & IF(E6<>"",E6&" - 2YR",))"
>> >.
>> >
>
>
>.
>



Relevant Pages

  • RE: Lookup
    ... the trick if you make its precondition if(and ... >> puts the col e value there if they are equal. ... >> Regards, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: list_head debugging.
    ... Ashley, any chance you can try and isolate which driver is causing this, by moving ... Maybe try that first, and if that does the trick, turn it back on and try the ...
    (Fedora)
  • Re: new record
    ... The trick will be to identify what is causing the error, ... if I add the minimal information to the record and close ... Once I reopend the form and go to the record all the ...
    (microsoft.public.access.formscoding)
  • Re: Epistemology 201: The Science of Science
    ... > it in front of you, you'll say it's a trick and dismiss it until it ... > curses you out and puts you in the kill file. ...
    (sci.math)
  • Re: Epistemology 201: The Science of Science
    ... > it in front of you, you'll say it's a trick and dismiss it until it ... > curses you out and puts you in the kill file. ...
    (sci.cognitive)