Solved

Tab Creation by List

Posted on 2011-03-25
3
184 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
Comment Utility
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
Comment Utility
ssaqibh,

PERFECT!  Works like a charm.

B.
0
 

Author Closing Comment

by:Bright01
Comment Utility
Quick, accurate, and works!

Much thanks,

B.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

743 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

16 Experts available now in Live!

Get 1:1 Help Now