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: 27,285
Default vlookup using a variable

ActiveCell.FormulaR1C1 = _
"=VLOOKUP (RC[-67], '" & _
TwoMonthsAgo & "'!C[-67],68,FALSE)"

--
Regards,
Tom Ogilvy

"Tony" wrote in message
...
When I run my macro it opens a file and inserts a new sheet named with the
month and year for last month "Aug04". In this sheet I want to do a

vlookup
into the previous months sheet for some information. I have a variable set

to
store the previous month and year but I am not sure how to use this

variable
in my line of code. The way I have it now is as follows:

ActiveCell.FormulaR1C1 = _
"=VLOOKUP (RC[-67], 'Jul04'!C[-67],68,FALSE)"

It works just fine if I specifically say to look at sheet < 'Jul04'

but
I want it to be automated to use my variable < TwoMonthsAgo . Thank you
for any suggestions.



 
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 using a variable for the workbook name Phil Excel Discussion (Misc queries) 4 November 10th 08 09:30 PM
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
variable vlookup Tom Ogilvy Excel Programming 2 September 8th 03 02:58 PM


All times are GMT +1. The time now is 06:32 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"