View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default code to unhide tabs based on cell contents

hi,

i guess the "tab's names" are in cells A4: AD4
you could use "Worksheet_SelectionChange" event to execute this task.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set isect = Application.Intersect(Target, Range("A4:AD4"))
If Not isect Is Nothing Then
Sheets(Target).Visible = True
Sheets(Target).Select
End If
End Sub


--
isabelle


Le 2011-08-25 14:03, pat67 a écrit :
Hi, I have a large file with 30 some tabs. what i want to do is hide
all the tabs except a contents tab and be able to unhide specific tabs
based on which cell someone clicks in. I can do it by putting in this

Sheets("NC-41282").Visible = True
Sheets("NC-41282").Select


But i have to do that for each NC-Number. what I am looking for is to
do it so the vba knows whic sheet to open based on which cell is
clicked. So cell B4 for example shows NC-41283. I wanted so when that
cell is clicked the tab NC-41283 opens. C4 would be NC-41284 and so
on. I am obviously not really adept at vba so any help would be
appreciated. Thanks