LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using cell name to open workbook

I'd use something like:

Dim DataRng as range
dim wb2 as workbook
set wb2 = workbooks.open(....)
with wb2.worksheets("someworksheetnamehere")
set datarng = .range("A2:AL65536")
end with

'make sure you're on the correct cell.

ActiveCell.FormulaR1C1 =
"=VLOOKUP(RC[-12]," _
& datarng.address(external:=true, ReferenceStyle:=xlR1C1) _
& ",3,FALSE)"





Orhan wrote:

Hi,

On H8 cell i have the value "data"
I managed to open the workbook named "data" using Range("H8")
Workbook.open function.

Set Wb2 = Workbooks.Open("c:\data\" & Range("H8") & ".xls")

How can I do the same thing in a vlookup formula?

ActiveCell.FormulaR1C1 =
"=VLOOKUP(RC[-12],data.xls!R2C1:R65008C38,3,FALSE)"

Thanks!


--

Dave Peterson
 
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
Click on cell to open another workbook dsimpson Excel Discussion (Misc queries) 1 September 17th 08 05:01 PM
How do I set up a workbook to open on a cell reference every time CAHM Excel Discussion (Misc queries) 2 November 30th 07 05:41 PM
Why does a new Excel Workbook open with IV1 as the active cell? pjwing Excel Discussion (Misc queries) 1 July 3rd 07 11:26 PM
Automatically increment numbers in a cell when you open workbook mrcall Excel Discussion (Misc queries) 2 March 3rd 07 10:26 PM
Open a workbook with a name that was recorded in a cell emil Excel Programming 0 April 15th 06 12:23 AM


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