Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reference workbook name | Excel Worksheet Functions | |||
Reference different workbook | Excel Programming | |||
How To Reference The Previous Or Next Workbook s | Excel Programming | |||
Reference code in another workbook from a calling workbook | Excel Programming | |||
cell reference in another workbook | Excel Programming |