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 a VLookUp

I have written some code as follows:

ActiveCell.FormulaR1C1 = "=vlookup(rc[-1]," & strTableRange & ",4,false)"

I populate strTableRange with the reference to the sheet4 as follows:

strTableRange =
Worksheets("sheet4").Range("A1").CurrentRegion.Add ress(external:=True,
ReferenceStyle:=xlR1C1)

I now want to move the sheet 4 into a separate file in the same folder and
have tried to reference it thus:

strTableRange =
"(Issues.xls)!worksheets("Sheet4").Range("A1").Cur rentRegion.Address(external:=True, ReferenceStyle:=xlR1C1)"

but it doesn't work. Can someone point out where my syntax is wrong? Many
thanks
--
thanks, Neil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing another workbook in a VLookUp

strTableRange = workbooks("Issues.xls").worksheets("Sheet4") _
.Range("A1").CurrentRegion.Address(external:=True, _
ReferenceStyle:=xlR1C1)

The Issues.xls workbook has to be open, too.

Highlystrung wrote:

I have written some code as follows:

ActiveCell.FormulaR1C1 = "=vlookup(rc[-1]," & strTableRange & ",4,false)"

I populate strTableRange with the reference to the sheet4 as follows:

strTableRange =
Worksheets("sheet4").Range("A1").CurrentRegion.Add ress(external:=True,
ReferenceStyle:=xlR1C1)

I now want to move the sheet 4 into a separate file in the same folder and
have tried to reference it thus:

strTableRange =
"(Issues.xls)!worksheets("Sheet4").Range("A1").Cur rentRegion.Address(external:=True, ReferenceStyle:=xlR1C1)"

but it doesn't work. Can someone point out where my syntax is wrong? Many
thanks
--
thanks, Neil


--

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

many thanks,
--
thanks, Neil


"Highlystrung" wrote:

I have written some code as follows:

ActiveCell.FormulaR1C1 = "=vlookup(rc[-1]," & strTableRange & ",4,false)"

I populate strTableRange with the reference to the sheet4 as follows:

strTableRange =
Worksheets("sheet4").Range("A1").CurrentRegion.Add ress(external:=True,
ReferenceStyle:=xlR1C1)

I now want to move the sheet 4 into a separate file in the same folder and
have tried to reference it thus:

strTableRange =
"(Issues.xls)!worksheets("Sheet4").Range("A1").Cur rentRegion.Address(external:=True, ReferenceStyle:=xlR1C1)"

but it doesn't work. Can someone point out where my syntax is wrong? Many
thanks
--
thanks, Neil

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
VLOOKUP - Referencing seperate workbook getting #N/A erros Reddo Excel Worksheet Functions 2 December 3rd 08 07:42 PM
copying worksheets to a new workbook without formulae referencing original workbook [email protected] Excel Programming 2 October 16th 06 07:31 PM
VLOOKUP referencing another workbook kleivakat Excel Discussion (Misc queries) 2 March 9th 06 05:35 PM
Referencing a cell when using VLOOKUP SandyUK[_8_] Excel Programming 6 November 12th 05 03:27 PM
Excel VBA - VLookup problem referencing another sheet in the same workbook StylinEric Excel Programming 7 May 18th 04 01:21 PM


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