LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Using a variable for the 2nd paremeter in a vlookup

Greetings,

I have a variable called myFile$ in my VBA that contains a file name. I
want to use it in the following VLookUp.

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-16],'[&myFile&]TOTAL'!R1C1:R548C11,
10, FALSE)"

When I run my script the variable doesn't resolve to the actual contents of
the variable. Instead I get a dialog box prompting me with "Update Values:"
as the title. When I cancel the ActiveCell indeed confirms that the vlookup
formula contains &myFile& as the second parameter.

The reason I need this is because my range for param 2 to vlookup is in a
different file everytime i run my macro.

Can someone advise as to a better way to do this and/or point me to some
documentation?

Thank you very much!
Jeff
 
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
set a variable based on a vlookup Debbie Horner Excel Discussion (Misc queries) 5 July 16th 08 06:16 PM
Variable col_index_num in vlookup Hugh Murfitt Excel Discussion (Misc queries) 1 February 15th 06 12:17 PM
using variable names in VLOOKUP Tony Excel Programming 1 October 20th 04 09:01 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 07:23 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"