Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to base my formula in my Excel based on some Input I get from the user. This I save in iLastYear, and have some labels (e.g. lBudgetLastYear etc) calculated from this. I tried using the formula under, but then Excel don't recognize the variables I put in (e.g. iLastYear, lBudgetLastYear etc) ActiveCell.FormulaR1C1 = _ "=IF(RC[-8]=iLastYear,IF(RC[-7] =1,lBudgetLastYear,lSum06LastYear),lSumSecondLastY ear)" How can I dynamically create an IF-sentence from VBA-code, and put in one cell in Excel? Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ten,
Try this (untested I am afraid) ActiveCell.FormulaR1C1 = _ "=IF(RC[-8]=" & iLastYear&"," _ "IF(RC[-7]=1," & lBudgetLastYear & "," & lSum06LastYear & ")," & _ lSumSecondLastYear & ")" -- HTH Bob Phillips "ten" wrote in message ... Hi, I am trying to base my formula in my Excel based on some Input I get from the user. This I save in iLastYear, and have some labels (e.g. lBudgetLastYear etc) calculated from this. I tried using the formula under, but then Excel don't recognize the variables I put in (e.g. iLastYear, lBudgetLastYear etc) ActiveCell.FormulaR1C1 = _ "=IF(RC[-8]=iLastYear,IF(RC[-7] =1,lBudgetLastYear,lSum06LastYear),lSumSecondLastY ear)" How can I dynamically create an IF-sentence from VBA-code, and put in one cell in Excel? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formulas do not update | Excel Worksheet Functions | |||
Formulas don't update | Excel Discussion (Misc queries) | |||
Formulas don't update. | Excel Discussion (Misc queries) | |||
Update Formulas | Excel Worksheet Functions | |||
Formulas will not update! | Excel Discussion (Misc queries) |