Solved

Tab Creation by List

Posted on 2011-03-25
3
190 Views
Last Modified: 2012-08-14
EE Professionals,

I have a simple list that when a paticular selection is made (by industry), I want Excel to "go to" the appropriate "Tab".  There should also be a "Return" button in each spreadsheet that returns you to the Selection Tab.

Hopefully this is not complex.

Thank you in advance,

B.
Simple-Tab-Selection.xlsm
0
Comment
Question by:Bright01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 35213602
Try this code.

Right-click on the selection tab and select "View code"
paste the code in this code window.

This will let you select a sheet from cell K5. You can change this by changing the two instances of K5 in the code below.

You can do the same to all the sheets. This way you will have the ability to go to any other sheet on the workbook.

If it must be a button on all the other sheets you can add a button and double click it in design mode and enter this line of code
Sheets("Selection").Activate

Saqib
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("K5").Address Then
On Error Resume Next
Sheets(Target.Value).Activate
On Error GoTo 0
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("K5").Address Then
wslist = ""
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then wslist = wslist & "," & ws.Name
Next ws
wslist = Right(wslist, Len(wslist) - 1)
    With Selection.Validation
        .Delete
        .Add Type:=xlValidateList, Formula1:=wslist
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With
End If
End Sub

Open in new window

0
 

Author Comment

by:Bright01
ID: 35214594
ssaqibh,

PERFECT!  Works like a charm.

B.
0
 

Author Closing Comment

by:Bright01
ID: 35214602
Quick, accurate, and works!

Much thanks,

B.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question