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

Hi

I have a macro which trails through x number of spreadsheets and updates
the current months values into a data book which is then linked to an output.

In the control sheet of my workbook i have a looping function which iterates
through each of the workbooks - however in the vlookup I am having difficulty
referencing the relevant workbook as a variable

The formula is as

Windows("MyWorkBooks").Activate
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-11],"REPORTNAME"! R33C3:R84C12,10,0)"

Where

Dim ReportName As String
ReportName = xxxxx.Value


Any suggestions as to what I am doing wrong ?

Many thanks in advance

Hardeep
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing a workbook in a lookup

Maybe...

ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-11],"REPORTNAME!R33C3:R84C12",10,0)"

But I'm not sure how the different workbooks enter the picture.

If you need different workbooks, you can build your formula manually (with the
sending workbook open) and then close that sending workbook.

Switch to R1C1 reference style and look at the formula. Then use that to build
the VBA code.

Spinz wrote:

Hi

I have a macro which trails through x number of spreadsheets and updates
the current months values into a data book which is then linked to an output.

In the control sheet of my workbook i have a looping function which iterates
through each of the workbooks - however in the vlookup I am having difficulty
referencing the relevant workbook as a variable

The formula is as

Windows("MyWorkBooks").Activate
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-11],"REPORTNAME"! R33C3:R84C12,10,0)"

Where

Dim ReportName As String
ReportName = xxxxx.Value

Any suggestions as to what I am doing wrong ?

Many thanks in advance

Hardeep


--

Dave Peterson
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
Referencing a cell where lookup value is not on same row Aaron Excel Worksheet Functions 6 November 21st 08 04:24 AM
Help! Need to lookup referencing 2 variables I M Desperate!!! Excel Worksheet Functions 3 June 17th 08 02:14 AM
copying worksheets to a new workbook without formulae referencing original workbook [email protected] Excel Programming 2 October 16th 06 07:31 PM
Referencing 3 values for a lookup chad Excel Worksheet Functions 2 August 16th 06 03:31 PM
What is the syntax for referencing another sheet with 'lookup' ihenderson Excel Worksheet Functions 3 July 31st 06 12:05 PM


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