Selecting the other open workbook

  • Thread starter Thread starter Karen
  • Start date Start date
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
 
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
 
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
 
Back
Top