A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

vlook on different tabs based on value



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2010, 06:46 PM posted to microsoft.public.excel.worksheet.functions
jatman
external usenet poster
 
Posts: 102
Default vlook on different tabs based on value

good day,

i have the following so far in my macro:

....
supcode = Range("B4").Value
....
If supcode = "CLI" Then
ActiveCell.Offset(0, 4) = "=VLOOKUP(RC[-4], '[Order
Generator.xlsm]CLI'!C2:C4,2,FALSE)"
....

right now i have this code repeated several times for each supcode that may
exist and i am usingn an if statement for each possible "supcode". i would
like to replace all the if statements, and change the "CLI" to use the
"supcode" value.

how do i get the "supcode" value into the vlookup code?

thank you,

jat
  #2  
Old May 5th, 2010, 06:48 PM posted to microsoft.public.excel.worksheet.functions
Luke M[_4_]
external usenet poster
 
Posts: 451
Default vlook on different tabs based on value

'All on one line
ActiveCell.Offset(0, 4) = "=VLOOKUP(RC[-4], '[Order Generator.xlsm]" &
supcode & "'!C2:C4,2,FALSE)"

--
Best Regards,

Luke M
"jatman" wrote in message
...
good day,

i have the following so far in my macro:

...
supcode = Range("B4").Value
...
If supcode = "CLI" Then
ActiveCell.Offset(0, 4) = "=VLOOKUP(RC[-4], '[Order
Generator.xlsm]CLI'!C2:C4,2,FALSE)"
...

right now i have this code repeated several times for each supcode that
may
exist and i am usingn an if statement for each possible "supcode". i
would
like to replace all the if statements, and change the "CLI" to use the
"supcode" value.

how do i get the "supcode" value into the vlookup code?

thank you,

jat



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:06 PM.


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