Solved

Tab Creation by List

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Quarter Increment Clock 2 15
Excel format formula for currency 15 22
Msbbox Notice (4 days) 27 58
Request to review costing formula 3 32
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

776 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