Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default vlookup with a variable

hello please help. in vba, i have the following statement

ActiveCell.Formula = "=VLOOKUP(" & sRef1 & " & d2,Sheet6!f:i,4,FALSE)"

actually, what i want to do is to encapsulate the variable sRef1 with
inverted commas. e.g. the variable value is A. so my lookup value is "A"&D2

does that make sense?

if so how do i do that?

cheers

--
MS SBS 2003 SP2
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default vlookup with a variable

ActiveCell.Formula = "=VLOOKUP(""A" & sRef1 & """ & d2,Sheet6!f:i,4,FALSE)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Mentos" wrote in message
...
hello please help. in vba, i have the following statement

ActiveCell.Formula = "=VLOOKUP(" & sRef1 & " & d2,Sheet6!f:i,4,FALSE)"

actually, what i want to do is to encapsulate the variable sRef1 with
inverted commas. e.g. the variable value is A. so my lookup value is
"A"&D2

does that make sense?

if so how do i do that?

cheers

--
MS SBS 2003 SP2



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default vlookup with a variable

thanks bob. actually the result was slightly diff to what i expected but i
understand your concept. i modified my statement to:

ActiveCell.Formula = "=VLOOKUP(""" & sRef1 & """ & d2,Sheet6!f:i,4,FALSE)"

and this yielded my result

cheers!


--
MS SBS 2003 SP2


"Bob Phillips" wrote:

ActiveCell.Formula = "=VLOOKUP(""A" & sRef1 & """ & d2,Sheet6!f:i,4,FALSE)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Mentos" wrote in message
...
hello please help. in vba, i have the following statement

ActiveCell.Formula = "=VLOOKUP(" & sRef1 & " & d2,Sheet6!f:i,4,FALSE)"

actually, what i want to do is to encapsulate the variable sRef1 with
inverted commas. e.g. the variable value is A. so my lookup value is
"A"&D2

does that make sense?

if so how do i do that?

cheers

--
MS SBS 2003 SP2




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
VLookup Variable Offset Glenda Excel Discussion (Misc queries) 1 April 7th 10 02:01 PM
Vlookup - Variable look_up value? Stcyrk Excel Discussion (Misc queries) 3 October 5th 07 10:17 PM
Using a variable for the 2nd paremeter in a vlookup JEFFWI Excel Programming 5 August 17th 07 10:54 PM
vlookup using a variable Tom Ogilvy Excel Programming 1 September 15th 04 11:01 PM
variable vlookup Tom Ogilvy Excel Programming 2 September 8th 03 02:58 PM


All times are GMT +1. The time now is 01:51 AM.

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

About Us

"It's about Microsoft Excel"