Generic Window Activate

M

Michael

Hi! I was wondering how to activate the nonactive workbook
open in Excel without naming it explicitly? For instance,
I would like to say Activeworkbooks(generic).activate
instead of Activeworkbooks("July ROI").activate

Thank you so much!

Michael
 
B

Bob Phillips

Michael,

You could try something like

For Each owb In Workbooks
If owb.Name <> ActiveWorkbook.Name Then
owb.Activate
End If
Next owb

but couldn't there be more than one?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
V

Vasant Nanavati

If there are only 2 windows (including hidden ones):

Windows((ActiveWindow.Index Mod 2)+1).Activate
 
D

Dick Kusleika

Michael

Also look at the ActivateNext and ActivatePrevious methods of the Window
object, e.g.

ActiveWindow.ActivateNext
 
Top