Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default LOOKUP filename construction

This is one of those question where the answer is so obvious I cannot see it!!

The following is part of a larger macro:-


filedate=Range("F115".Value 'value is date in format dd/mm/yyyy
fileyear=Right(filedate,4)
lastyear=(fileyear-1)

lastyearfile="Planner-" & lastyear & ".xls"

Sheet ("Plan 1").Sheet
Range("E3").Select

ActiveCell.FormulaR1C1="LOOKUP(R[-1]C,'[lastyearfile]Plan 1'!R2C5:R3C20



It is the last line that contains an error as the 'lastyearfile' value is
not being identified. Debug shows it is carried through to this point.

I know it is to do with brackets and quotation marks - but my mind just
cannot see it

Any help appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default LOOKUP filename construction

ActiveCell.FormulaR1C1="LOOKUP(R[-1]C,'[" & lastyearfile & "]Plan
1'!R2C5:R3C20"


--
HTH

Bob

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

"SyZyGy" wrote in message
...
This is one of those question where the answer is so obvious I cannot see
it!!

The following is part of a larger macro:-


filedate=Range("F115".Value 'value is date in format dd/mm/yyyy
fileyear=Right(filedate,4)
lastyear=(fileyear-1)

lastyearfile="Planner-" & lastyear & ".xls"

Sheet ("Plan 1").Sheet
Range("E3").Select

ActiveCell.FormulaR1C1="LOOKUP(R[-1]C,'[lastyearfile]Plan 1'!R2C5:R3C20



It is the last line that contains an error as the 'lastyearfile' value is
not being identified. Debug shows it is carried through to this point.

I know it is to do with brackets and quotation marks - but my mind just
cannot see it

Any help appreciated



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default LOOKUP filename construction - Thanks - Problem solved

Thanks - Easy when you know how!

"Bob Phillips" wrote:

ActiveCell.FormulaR1C1="LOOKUP(R[-1]C,'[" & lastyearfile & "]Plan
1'!R2C5:R3C20"


--
HTH

Bob

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

"SyZyGy" wrote in message
...
This is one of those question where the answer is so obvious I cannot see
it!!

The following is part of a larger macro:-


filedate=Range("F115".Value 'value is date in format dd/mm/yyyy
fileyear=Right(filedate,4)
lastyear=(fileyear-1)

lastyearfile="Planner-" & lastyear & ".xls"

Sheet ("Plan 1").Sheet
Range("E3").Select

ActiveCell.FormulaR1C1="LOOKUP(R[-1]C,'[lastyearfile]Plan 1'!R2C5:R3C20



It is the last line that contains an error as the 'lastyearfile' value is
not being identified. Debug shows it is carried through to this point.

I know it is to do with brackets and quotation marks - but my mind just
cannot see it

Any help appreciated




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
SaveAs Filename:=filename, FileFormat:=xlCSV Teddy[_3_] Excel Programming 2 May 29th 07 02:34 PM
How do I lookup large number of workbooks (by filename) for data? Kaby Excel Programming 0 August 29th 06 12:31 AM
Converting a Variable Filename to a Constant Filename Magnivy Excel Programming 2 August 15th 06 06:13 PM
range construction Gixxer_J_97[_2_] Excel Programming 4 June 9th 05 02:14 PM
formula construction II Gixxer_J_97[_2_] Excel Programming 2 June 7th 05 12:25 AM


All times are GMT +1. The time now is 03:21 PM.

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

About Us

"It's about Microsoft Excel"