Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Worksheet function

Hi Folks. I am tryig to do a VLookUp from code. I am
using a variable to capture the lookup value, which is
the name of the worksheet. ThisSheet is the variable name
and it might be "AA", as an example. If I try putting a
formula on the worksheet to capture a value on another
sheet in the workbook by using:

ActiveCell.FormulaR1C1 = "=VLOOKUP(" & (ThisSheet) & " ,
ClosesStock!C[-6]:C[-5],2,False)"

I lose the quote marks around the lookup value and get a
#NAME? error and do not get a value to capture.

Any suggestions would be appreciated, including using
Application.Worksheet function or modifying the above
formula. Thanks folks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Worksheet function

Hi David

try

ActiveCell.FormulaR1C1 ="=VLOOKUP(""" & ThisSheet &
""",ClosesStock!C[-6]:C[-5],2,False)"

Cheers
JulieD


"David" wrote in message
...
Hi Folks. I am tryig to do a VLookUp from code. I am
using a variable to capture the lookup value, which is
the name of the worksheet. ThisSheet is the variable name
and it might be "AA", as an example. If I try putting a
formula on the worksheet to capture a value on another
sheet in the workbook by using:

ActiveCell.FormulaR1C1 = "=VLOOKUP(" & (ThisSheet) & " ,
ClosesStock!C[-6]:C[-5],2,False)"

I lose the quote marks around the lookup value and get a
#NAME? error and do not get a value to capture.

Any suggestions would be appreciated, including using
Application.Worksheet function or modifying the above
formula. Thanks folks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Worksheet function

That got it. Thanks.
-----Original Message-----
Hi David

try

ActiveCell.FormulaR1C1 ="=VLOOKUP(""" & ThisSheet &
""",ClosesStock!C[-6]:C[-5],2,False)"

Cheers
JulieD


"David" wrote in

message
...
Hi Folks. I am tryig to do a VLookUp from code. I am
using a variable to capture the lookup value, which is
the name of the worksheet. ThisSheet is the variable

name
and it might be "AA", as an example. If I try putting a
formula on the worksheet to capture a value on another
sheet in the workbook by using:

ActiveCell.FormulaR1C1 = "=VLOOKUP(" & (ThisSheet)

& " ,
ClosesStock!C[-6]:C[-5],2,False)"

I lose the quote marks around the lookup value and get

a
#NAME? error and do not get a value to capture.

Any suggestions would be appreciated, including using
Application.Worksheet function or modifying the above
formula. Thanks folks.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Worksheet function

Hi David

you're welcome and thanks for the feedback.

Cheers
JulieD

"David" wrote in message
...
That got it. Thanks.
-----Original Message-----
Hi David

try

ActiveCell.FormulaR1C1 ="=VLOOKUP(""" & ThisSheet &
""",ClosesStock!C[-6]:C[-5],2,False)"

Cheers
JulieD


"David" wrote in

message
...
Hi Folks. I am tryig to do a VLookUp from code. I am
using a variable to capture the lookup value, which is
the name of the worksheet. ThisSheet is the variable

name
and it might be "AA", as an example. If I try putting a
formula on the worksheet to capture a value on another
sheet in the workbook by using:

ActiveCell.FormulaR1C1 = "=VLOOKUP(" & (ThisSheet)

& " ,
ClosesStock!C[-6]:C[-5],2,False)"

I lose the quote marks around the lookup value and get

a
#NAME? error and do not get a value to capture.

Any suggestions would be appreciated, including using
Application.Worksheet function or modifying the above
formula. Thanks folks.



.



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
if worksheet function supersonikk Excel Worksheet Functions 9 April 8th 08 07:59 AM
Get a Worksheet name through a function Tetsuya Oguma Excel Worksheet Functions 2 March 10th 06 03:29 AM
Reference the worksheet from a multiple worksheet range function ( DBickel Excel Worksheet Functions 1 May 28th 05 03:49 AM
Can the offset worksheet function reference another worksheet AlistairJ Excel Worksheet Functions 2 May 9th 05 06:18 PM
WorkSheet Function Dthmtlgod[_2_] Excel Programming 5 May 20th 04 09:55 PM


All times are GMT +1. The time now is 07:52 PM.

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"