How to pass arguments to vlookup in VBA
:confused: Could some one pls tell me how to go about this ??? xtenv = activecell.value ActiveCell.Offset(0, 2).Formula = "=VLOOKUP(xtenv,CODE,2,FALSE)" I want to automatically lookup values in the active cell however the above command does not get me the right answer... where could i be wrong thanks -- mathewg ------------------------------------------------------------------------ mathewg's Profile: http://www.excelforum.com/member.php...o&userid=30646 View this thread: http://www.excelforum.com/showthread...hreadid=503225 |
How to pass arguments to vlookup in VBA
try this and see if it works
ActiveCell.Offset(0, 2).Formula = "=VLOOKUP(" & xtenv & ",CODE,2,FALSE)" -- Gary "mathewg" wrote in message ... :confused: Could some one pls tell me how to go about this ??? xtenv = activecell.value ActiveCell.Offset(0, 2).Formula = "=VLOOKUP(xtenv,CODE,2,FALSE)" I want to automatically lookup values in the active cell however the above command does not get me the right answer... where could i be wrong thanks -- mathewg ------------------------------------------------------------------------ mathewg's Profile: http://www.excelforum.com/member.php...o&userid=30646 View this thread: http://www.excelforum.com/showthread...hreadid=503225 |
How to pass arguments to vlookup in VBA
sorry, forgot the quotes
ActiveCell.Offset(0, 2).Formula = "=VLOOKUP(" & """" & xtenv & """" & ",CODE,2,FALSE)" -- Gary "mathewg" wrote in message ... :confused: Could some one pls tell me how to go about this ??? xtenv = activecell.value ActiveCell.Offset(0, 2).Formula = "=VLOOKUP(xtenv,CODE,2,FALSE)" I want to automatically lookup values in the active cell however the above command does not get me the right answer... where could i be wrong thanks -- mathewg ------------------------------------------------------------------------ mathewg's Profile: http://www.excelforum.com/member.php...o&userid=30646 View this thread: http://www.excelforum.com/showthread...hreadid=503225 |
How to pass arguments to vlookup in VBA
the code is all 1 line, so watch the word wrap
-- Gary "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... sorry, forgot the quotes ActiveCell.Offset(0, 2).Formula = "=VLOOKUP(" & """" & xtenv & """" & ",CODE,2,FALSE)" -- Gary "mathewg" wrote in message ... :confused: Could some one pls tell me how to go about this ??? xtenv = activecell.value ActiveCell.Offset(0, 2).Formula = "=VLOOKUP(xtenv,CODE,2,FALSE)" I want to automatically lookup values in the active cell however the above command does not get me the right answer... where could i be wrong thanks -- mathewg ------------------------------------------------------------------------ mathewg's Profile: http://www.excelforum.com/member.php...o&userid=30646 View this thread: http://www.excelforum.com/showthread...hreadid=503225 |
How to pass arguments to vlookup in VBA
Thanks a ton ... :) -- mathewg ------------------------------------------------------------------------ mathewg's Profile: http://www.excelforum.com/member.php...o&userid=30646 View this thread: http://www.excelforum.com/showthread...hreadid=503225 |
All times are GMT +1. The time now is 04:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com