excel vba: setting the formula to equal A or B if not found A

Posted by every_answer_gets_a_point on Stack Overflow See other posts from Stack Overflow or by every_answer_gets_a_point
Published on 2010-05-18T17:07:01Z Indexed on 2010/05/18 17:10 UTC
Read the original article Hit count: 187

Filed under:
|

i have a vba line of code like this:

ActiveCell.FormulaR1C1 = "=LOOKUP(""ETG_C"",RC[-10],RC[-8])"

i would like to know how is it possible to have the activecell formula be something else in the case that it does not find ETG_C

for example:

=if(not(LOOKUP(""ETG_C"",RC[-10],RC[-8]))) then =LOOKUP(""something_else"",RC[-10],RC[-8])

© Stack Overflow or respective owner

Related posts about excel

Related posts about vba