简体   繁体   中英

How to use “This Row” in VBA VLOOKUP?

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.

使用R1C1风格

Activecell.FormulaR1C1 = "=VLOOKUP(RC9, ItemLookup, 22, false)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM