Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Referencing another workbook in equation

In VBA I am placing a formula into a cell to copy down.

The equation is something like

ActiveCell.FormulaR1C1 = "=Vlookup(value(RC[-4]),
[tempworkbook]terms!A:F,5,false)"

I have specified the other workbook as Tempbook (using Tempbook =
ActiveWorkbook.name) as this is an uncontrolled variable.

the Excel formula should end up looking like (assuming tempbook is called
book9)

=Vlookup(Value(A10),[book9]Terms!$A:$F,5,FALSE)

I know its something to do with the workbook location (I think) how do I get
this to work.

Thanks
Dave



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Referencing another workbook in equation

Since Tempbook is a variable, which won't be evaluated inside a string,
you must concatenate your formula. Also, if you're using R1C1 notation,
then A:F won't work. Try:

ActiveCell.FormulaR1C1 = "=Vlookup(value(RC[-4]),'[" & _
Tempbook & "]terms'!C1:C6,5,FALSE)"

In article ,
"dht" wrote:

In VBA I am placing a formula into a cell to copy down.

The equation is something like

ActiveCell.FormulaR1C1 = "=Vlookup(value(RC[-4]),
[tempworkbook]terms!A:F,5,false)"

I have specified the other workbook as Tempbook (using Tempbook =
ActiveWorkbook.name) as this is an uncontrolled variable.

the Excel formula should end up looking like (assuming tempbook is called
book9)

=Vlookup(Value(A10),[book9]Terms!$A:$F,5,FALSE)

I know its something to do with the workbook location (I think) how do I get
this to work.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Referencing another workbook in equation

Have tried that and it doesn't seem to work. I'll have a play around with it
though.

Thanks
Dave

"JE McGimpsey" wrote in message
...
Since Tempbook is a variable, which won't be evaluated inside a string,
you must concatenate your formula. Also, if you're using R1C1 notation,
then A:F won't work. Try:

ActiveCell.FormulaR1C1 = "=Vlookup(value(RC[-4]),'[" & _
Tempbook & "]terms'!C1:C6,5,FALSE)"

In article ,
"dht" wrote:

In VBA I am placing a formula into a cell to copy down.

The equation is something like

ActiveCell.FormulaR1C1 = "=Vlookup(value(RC[-4]),
[tempworkbook]terms!A:F,5,false)"

I have specified the other workbook as Tempbook (using Tempbook =
ActiveWorkbook.name) as this is an uncontrolled variable.

the Excel formula should end up looking like (assuming tempbook is

called
book9)

=Vlookup(Value(A10),[book9]Terms!$A:$F,5,FALSE)

I know its something to do with the workbook location (I think) how do I

get
this to work.



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
I need an Equation in a cell to search a workbook not worksheet MWhaley Excel Worksheet Functions 5 November 2nd 08 12:27 AM
Prevent equation from skipping data when referencing import data? lybrt98 Excel Discussion (Misc queries) 0 August 30th 05 05:01 PM
Equation Referencing Row Number Stored in Cell Jim Hagan Excel Discussion (Misc queries) 1 April 13th 05 09:04 PM
referencing another workbook steve Excel Programming 0 May 7th 04 02:49 PM
Referencing one workbook in other??? Haldun Alay[_2_] Excel Programming 3 August 20th 03 04:29 PM


All times are GMT +1. The time now is 12:10 AM.

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"