![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com