Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to pass arguments to vlookup in VBA





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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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 ...




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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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 ...




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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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 ...




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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass variables as arguments of a function Excel-craze Excel Worksheet Functions 1 August 12th 09 11:48 AM
Can I pass arguments to my formatted empty spreadsheet file? Paul H[_2_] Excel Discussion (Misc queries) 3 July 25th 09 07:34 PM
Too many arguments-VLOOKUP instead? Trina` Excel Worksheet Functions 2 July 4th 05 10:13 AM
Run/execute VBS and pass arguments Claud Balls Excel Programming 3 February 4th 05 08:34 AM
How to pass arguments from ThisWorkbook to a UserForm strataguru[_4_] Excel Programming 1 October 7th 03 11:29 PM


All times are GMT +1. The time now is 12:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"