ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting the other open workbook (https://www.excelbanter.com/excel-programming/274757-selecting-other-open-workbook.html)

Karen[_6_]

Selecting the other open workbook
 
Is there code to select the only other open workbook (it
only has one worksheet)? I've written code into one
workbook, but the macro will run in another book.
Unfortunately, I don't work with Excel-savvy people, and
my goal is to make this as simple as possible, so I want
to create a button in the workbook with the code...but I
don't know how to make the code know to select the other
book to run.

Any thoughts? Thanks,
Karen

Tom Ogilvy

Selecting the other open workbook
 
Could it be any workbook or will the workbook have a specific name.

It if has a specific name, then you can just reference that workbook.

With Workbooks("OtherWorkbookName.xls")
.worksheets(1).Range("A1").Value = int(rnd()*100+1)
' and so forth


--
Regards,
Tom Ogilvy



"Karen" wrote in message
...
Is there code to select the only other open workbook (it
only has one worksheet)? I've written code into one
workbook, but the macro will run in another book.
Unfortunately, I don't work with Excel-savvy people, and
my goal is to make this as simple as possible, so I want
to create a button in the workbook with the code...but I
don't know how to make the code know to select the other
book to run.

Any thoughts? Thanks,
Karen




Karen[_6_]

Selecting the other open workbook
 
No - the other workbook will consistently be changing and
will always have a different name. Is there any way to
just designate the other workbook without naming it? It
will always be the only other workbook open, and it will
always only have one worksheet, so the name is
irrelevant. (Or is it?)

Thanks,
Karen

-----Original Message-----
Could it be any workbook or will the workbook have a

specific name.

It if has a specific name, then you can just reference

that workbook.

With Workbooks("OtherWorkbookName.xls")
.worksheets(1).Range("A1").Value = int(rnd()*100+1)
' and so forth


--
Regards,
Tom Ogilvy



"Karen" wrote in message
...
Is there code to select the only other open workbook (it
only has one worksheet)? I've written code into one
workbook, but the macro will run in another book.
Unfortunately, I don't work with Excel-savvy people, and
my goal is to make this as simple as possible, so I want
to create a button in the workbook with the code...but I
don't know how to make the code know to select the other
book to run.

Any thoughts? Thanks,
Karen



.



All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com