View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
petedacook petedacook is offline
external usenet poster
 
Posts: 27
Default Why does the Formula in VBA not calculate

yes...that is the formula I have. It is seperated by _
which is a line break.

"p45cal" wrote:


are you looking for:
Activecell.FormulaR1C1="=IF(OR(RC[-2]=Cond1,RC[-2]=Cond2,RC[-2]=Cond3,RC[-2]=Cond4,RC[-2]=Cond5,RC[-2]=Cond6,RC[-2]=Cond7,RC[-2]=Cond8,RC[-2]=Cond9,RC[-2]=Cond10,RC[-2]=Cond11,RC[-2]=Cond12,RC[-2]=Cond13),"&
"""C&I""" & ",RC[1])"

?

petedacook;435310 Wrote:
I have some code that plugs in a formula. The formula is not
calculating
and instead is showing up as the code itself.

This is the formula:
ActiveCell.FormulaR1C1 = _

"=IF(OR(RC[-2]=Cond1,RC[-2]=Cond2,RC[-2]=Cond3,RC[-2]=Cond4,RC[-2]=Cond5,RC[-2]=Cond6,RC[-2]=Cond7,RC[-2]=Cond8,RC[-2]=Cond9,RC[-2]=Cond10,RC[-2]=Cond11,RC[-2]=Cond12,RC[-2]=Cond13),""C&I"",RC[1])"

Once the code runs, the cells show this:
=IF(OR(RC[-2]=Cond1,RC[-2]=Cond2,RC[-2]=Cond3,RC[-2]=Cond4,RC[-2]=Cond5,RC[-2]=Cond6,RC[-2]=Cond7,RC[-2]=Cond8,RC[-2]=Cond9,RC[-2]=Cond10,RC[-2]=Cond11,RC[-2]=Cond12,RC[-2]=Cond13),"C&I",RC[1])


instead of the results. Note: COND1, cond2, cond3, cond4, etc. are a
named
range in another sheet. Can anyone please tell me why the code is not
calculating? As a side note....the cells are formatted as text after
code
run....and general before the code runs.



--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=120844