Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Workbook reference

I have a cell in a workbook that has the path of another workbook in
it. i can succesfully use the path to Open the workbook as such,
"Workbooks.Open Filename:=Range("M1").Value. This works great. Its
actuall the full path with directories. I then have another cell with
just the name of the book to use for referencing it once it is already
open. I just want to activate it using a code like
"Windows("N1").Activate, so i can jump to it. This doesn't work and im
not sure how to do it. I have also tried calling the path a string to
no avail. Any help is great. Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Workbook reference

Maybe this:

Workbooks(Range("N1").Value).Activate

HTH,
Paul


wrote in message
ups.com...
I have a cell in a workbook that has the path of another workbook in
it. i can succesfully use the path to Open the workbook as such,
"Workbooks.Open Filename:=Range("M1").Value. This works great. Its
actuall the full path with directories. I then have another cell with
just the name of the book to use for referencing it once it is already
open. I just want to activate it using a code like
"Windows("N1").Activate, so i can jump to it. This doesn't work and im
not sure how to do it. I have also tried calling the path a string to
no avail. Any help is great. Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Workbook reference

could try
With Sheets("yoursheetname").Range("yourCell").Activate

Or ActiveSheet.Range("yourCell").Activate

Hope this helps

" wrote:

I have a cell in a workbook that has the path of another workbook in
it. i can succesfully use the path to Open the workbook as such,
"Workbooks.Open Filename:=Range("M1").Value. This works great. Its
actuall the full path with directories. I then have another cell with
just the name of the book to use for referencing it once it is already
open. I just want to activate it using a code like
"Windows("N1").Activate, so i can jump to it. This doesn't work and im
not sure how to do it. I have also tried calling the path a string to
no avail. Any help is great. Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Workbook reference

You could use variables for each of these workbooks.

With just a couple of workbooks, I'd do something like:

dim wkbk1 as workbook
dim wkbk2 as workbook

with worksheets("sheet999")
set wkbk1 = workbooks.open(filename:=.range("m1").value)
set wkbk2 = workbooks.open(filename:=.range("N1").value)
end with

wkbk1.activate
'or
wkbk2.activate

======
If you have a few more workbooks, you may want to build an array of workbooks.

dim myRng as range
dim myCell as range
dim wkbk() as workbook
dim iCtr as long

set myrng = worksheets("sheet999").range("M1:Q1")
redim wkbk(1 to myrng.cells.count)
ictr = 0
for each mycell in myrng.cells
ictr = ictr + 1
set wkbk(ictr) = workbooks.open(filename:=mycell.value)
next mycell

Then you'll have an array of workbooks that you can loop through (if you
wanted).






=======

If you really want to go through the windows collection, you'll have to use just
the filename (drop the drive and path) from the string.

Windows("C:\my documents\excel\book1.xls").activate
will not work
windows("book1.xls").activate
may work (if there is a window with that name)


wrote:

I have a cell in a workbook that has the path of another workbook in
it. i can succesfully use the path to Open the workbook as such,
"Workbooks.Open Filename:=Range("M1").Value. This works great. Its
actuall the full path with directories. I then have another cell with
just the name of the book to use for referencing it once it is already
open. I just want to activate it using a code like
"Windows("N1").Activate, so i can jump to it. This doesn't work and im
not sure how to do it. I have also tried calling the path a string to
no avail. Any help is great. Thanks


--

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
Reference workbook name Chris Excel Worksheet Functions 3 August 10th 06 03:57 PM
Reference different workbook chris100[_62_] Excel Programming 2 April 14th 06 08:33 PM
How To Reference The Previous Or Next Workbook s Minitman[_4_] Excel Programming 1 November 1st 05 02:00 PM
Reference code in another workbook from a calling workbook Datasort Excel Programming 1 January 4th 05 01:13 AM
cell reference in another workbook spence[_3_] Excel Programming 1 February 5th 04 03:50 AM


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