Solved

Tab Creation by List

Posted on 2011-03-25
3
185 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now