ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to step to next open workbook (https://www.excelbanter.com/excel-programming/325379-macro-step-next-open-workbook.html)

drbobsled

Macro to step to next open workbook
 
I usually have several workbooks open.
Each one is an information form for a different seismic data load I'm
working on.

Is there a macro the when clicked on will move me to the next open file in
the ring?
And start at WB #1 when it get to the end of the ring?
Of course, previous WB, first WB and Last WB macros would be built from the
next open file macro.

DrBobsled

gocush[_29_]

Macro to step to next open workbook
 
See if something like this works:

Option Explicit
Public N As Integer


Sub ActivateBooks()
If N < 1 Then N = 1
If N Workbooks.Count Then N = 1
Workbooks(N).Activate
N = N + 1
End Sub

"drbobsled" wrote:

I usually have several workbooks open.
Each one is an information form for a different seismic data load I'm
working on.

Is there a macro the when clicked on will move me to the next open file in
the ring?
And start at WB #1 when it get to the end of the ring?
Of course, previous WB, first WB and Last WB macros would be built from the
next open file macro.

DrBobsled



All times are GMT +1. The time now is 03:43 AM.

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