Workbook Index numbering

julhs

Active Member
Joined
Dec 3, 2018
Messages
407
Office Version
  1. 2010
Platform
  1. Windows
Want to understand the order of WorkBook Index numbering.
Suppose:
In my Excel StartUp folder I have, “PERSONAL.XLSB” and “xl2bb.xlam”
On opening Workbook “Me” it opens a second Workbook (“Me Plus One”)

So query is; what is the index number of each Workbook opened?
My, quite probably slued logic is:
Excel StartUp folder = Index 1
Workbook “Me” = Index 2
Workbook “Me plus One” = Index 3

Other possibility is (and most likely) I completely misunderstand the whole Index numbering thing.!!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Taken me a while to get back to resolving this query, been a bit side tracked.
Came up with the below that returns the answer to my query.

VBA Code:
Option Explicit
   Sub WorkbookIndexNameLoop()
   Dim wb_Count As Integer
   Dim I As Integer

       ' Sets wb_Count equal to the number of Open Workbooks
   wb_Count = Workbooks.Count

       ' Begin the loop.
   For I = 1 To wb_Count

      ' The following line shows the reference to ALL Open Workbooks (one by one) within
      ' the loop and increments (accordingly) the Workbook Index# and shows its WorkbookName in a dialog box.
      ' Workbooks (" & I & "), is the part that does the incrementing

    MsgBox "Workbooks (" & I & ")  is" & vbCrLf & vbCrLf & Workbooks(I).Name
 
   Next I
 End Sub
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top