Frage

I am trying to modify a Vlookup function so that it uses "this row" functionality. For example I have a macro that places in Column B the Following formula:

=VLOOKUP(I1253,treatlookup,11,FALSE)

This works well, however during the macro, I need to have it switch over to another formula:

=VLOOKUP(I1253,Itemlookup,22,FALSE)

Of course the data varies everytime so I can not just have that formula put in at a specific cell. So what I would like the formula to state is

= Vlookup(I"CurrentRow", ItemLookup, 22,False)

I can then use an if statement to determine which of the two formulas to use.

thanks in Advance Using Excel 2010.

War es hilfreich?

Lösung

Use R1C1 style:

Activecell.FormulaR1C1 = "=VLOOKUP(RC9, ItemLookup, 22, false)"
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top