View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Zone
 
Posts: n/a
Default Macro switch between windows question

This should work if you have only two workbooks open:
For j=1 to workbooks.count
if workbooks(j).name<activeworkbook.name then
workbooks(j).activate
exit for
end if
next j

James

punter wrote:
Hi,

I have a macro that is flipping between two windows. I recorded it and
I'm running into an error. The sheet I was playing around with and
recorded it on was called Book1. The macro will be run on sheets with
different names. The debugger is highlighting this line:

Windows("Book1.xls").Activate

How do I make windows go the other open workbook no matter what the
name is?

Thanks

Eddie


--
punter


------------------------------------------------------------------------
punter's Profile: http://www.excelforum.com/member.php...fo&userid=2044
View this thread: http://www.excelforum.com/showthread...hreadid=554196