Building an Index of worksheets

SandsB

Well-known Member
Joined
Feb 13, 2007
Messages
718
Office Version
  1. 365
Platform
  1. Windows
I have an Excel file with about 75 worksheets. Each of those worksheets is assigned to 1 of a few people (it fluctuates). It's a pain to scroll all over the place looking for worksheets assigned to a specific person. Way back when, someone here helped with something that updated a sort of Table of Contents page that listed each worksheet and included a link to it - click the name and it would take you to that worksheet. I put that to good use but I'm in a different job now and lost track of that file. What that didn't do and what I'm looking for now is the same thing but in one column show the name of the worksheet and in another show the person assigned. That person is always listed in cell B6 in each worksheet. Doable?

Worksheet1 Name Person Assigned Name
Worksheet2 Name Person Assigned Name
Worksheet3 Name Person Assigned Name
Worksheet4 Name Person Assigned Name
etc
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
If you're going to have everything in the first sheet and the first sheet is part of the data gathering, it will overwrite the name in B6.
Start with the 2nd Sheet?
 
Upvote 0
Another option is to add each person's user login name on the sheets, along with their names. You can use that to automatically go to the correct sheet without having to maintain a table of contents. You could either navigate to the correct sheet when they open the workbook, or simply have a single button to navigate automatically to their sheet. A macro could be created that simply searches each sheet for the login name.

This line can get the user's login name
VBA Code:
CurUser = UCase(Environ("UserName"))
 
Upvote 0
Looks like Jeffrey Mahoney's solution is the simplest.

Try so.
In a regular Module (Module1?)
Code:
Sub Get_Sheet_Names()
Dim i As Long
    For i = 2 To ThisWorkbook.Worksheets.Count
        With Cells(i, 1)
            .Value = Worksheets(i).Name
            .Offset(, 1).Value = Worksheets(i).Range("B6").Value
        End With
    Next i
End Sub
In the Sheet Module where the Sheet Names/People Names are
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 1 And Len(Target) <> 0 Then Sheets(Target.Value).Select
End Sub
 
Upvote 0
Apply this to a button or add to THISWORKBOOK module using "Private Sub Workbook_Open()"

VBA Code:
Sub NavigateToUserSheet()
  Dim WS As Worksheet
  Dim LoginName As String
  
  LoginName = UCase(Environ("UserName"))
  
  For Each WS In ThisWorkbook.Worksheets
    Debug.Print WS.Name
    If InStr(WS.Range("B6").Value, LoginName) > 0 Then
      WS.Activate
      Exit For
    End If
  Next WS
  
End Sub
 
Upvote 0
Maybe something like this will work for you?:

(this will only work with the desktop version of excel)

IndexWorksheets.xlsx
ABC
1NameWorksheetHyperlink to sheet
2John ConnorWorksheet 1go…
3Marty McFlyWorksheet 2go…
Index
Cell Formulas
RangeFormula
C2:C3C2=LET(fp,CELL("filename"), filename, TEXTBEFORE(TEXTAFTER(fp,"["),"]"), HYPERLINK("["&filename&"]'"&B2&"'!A1", "go…") )


1722532698284.png


Text in worksheet column hast to be exactly the name of each sheet.

And you could add a hyprelink back to the Index Sheet like this:

1722532859857.png


Don't know if this is what you need.
 
Upvote 0
I think there's a combination of me not explaining well enough and me not skilled enough to understand some of the responses. I added jolivanes' code and it give me a perfect index showing the name of the worksheet and the name of the person. Works great but there's no links to the worksheets. The image in felixstraube's response with the "go..." links looks good but I don't understand the code. The text in column A linking to the appropriate worksheet would also work.
(Incidentally, one person could be assigned multiple worksheets).
 
Upvote 0
So with the code I provided, all you need to do is put each person's login name in each of the worksheets they are assigned. Cell B6 could have multiple names/login names.
 
Upvote 0
Jeffrey, trying to understand your code. I'm not one of you Excel gurus. Does it open a worksheet for the user logged in? I'm looking for an index - users will have multiple worksheets but still need to see some assigned to others.
 
Upvote 0
It does take the user to a worksheet. Add a button to any sheet and link it to that macro you pasted into a standard module. Since you are testing it, go put your login name on any of the sheets in cell B6. Now, go click the button.

If a user doesn't know their login name use this
VBA Code:
Sub DispalyLoginName()
  MsgBox UCase(Environ("UserName"))
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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