Selecting the other open workbook

K

Karen

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
 
T

Tom Ogilvy

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
 
K

Karen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top