vba hide tab according to cell value

I have 10 tabs each with a different manager's name.  My first sheet will serve sort of as a navigation sheet if you will.  Once they select their name on the navigation sheet I need a macro to hide all sheets whose name does not contain the manger name that was chosen.  I could proceed on my own but how do you search a sheet name for a certain name?
BigWill5112Asked:
Who is Participating?
 
Rob HensonFinance AnalystCommented:
See similar example attached.

All sheets start off hidden until sheet name selected on first sheet.

Use the Format Sheet menu to unhide the sheets, change the names and the references on sheet 1 will also change. The rehide the sheets.

This uses the hyperlink method but the hyperlink requires the destination to be unhidden. The hyperlink goes to the same cell as the hyperlink but there is code on the sheet that recognises the hyperlink selection event and unhides and activates the relavant sheet.

Thanks
Rob H

Sheet-navigation.xls
0
 
Ardhendu SarangiSr. Project ManagerCommented:
hi,
Can you try the following code -

I have taken an example of two managers - John and Jane in this case.

Thanks,
Ardhendu

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cel As Range, targ As Range
    Dim i As Integer
    Set targ = [F6]    'Watch these cells for changes
    Set targ = Intersect(targ, Target)
    If targ Is Nothing Then Exit Sub

    Application.ScreenUpdating = False
    Application.EnableEvents = False
    For i = 1 To Worksheets.Count
        If Worksheets(i).Name = targ.Value Or Worksheets(i).Name = "Summary" Then
            Worksheets(i).Visible = True
        Else
            Worksheets(i).Visible = False
        End If
    Next
    Application.ScreenUpdating = True
    Application.EnableEvents = True
    MsgBox ("Done!")
End Sub

Open in new window

Managers.xls
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.