+ Reply to Thread
Results 1 to 5 of 5

Linking DropDown box options to worksheets

Hybrid View

  1. #1
    Registered User
    Join Date
    02-19-2010
    Location
    Cambridge, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Linking DropDown box options to worksheets

    Hi all,

    Sorry if this has been asked before, I've done some research online and I couldn't find a solution, so I thought I'd ask myself!

    Basically I have an intro page for a spreadsheet, with a DropDown box (couldbe Combo is thats easier) I need to have a series of options within the DropDown box, that when you click on it, links you to sheet within the workbook.

    So far I have:

    Private Sub DropDown14_Change()
      
    Select Case Range("AR86:AR105").Text
    
    Case "Option1t"
    Range("H:\Docs\CV Tracking.xlsx#sheet3!A1").Select
    
    Case "Option2"
    Range("H:\Docs\CV Tracking.xlsx#sheet4!A1").Select
    
    
    End Select
    End Sub
    but I've also tried:

    Private Sub ComboBox1_Click()
        ComboBox1.DropDown
    End Sub
    
    Private Sub Userform_Initialize()
        ComboBox1.AddItem "Option1"
        ComboBox1.AddItem "Option2"
        ComboBox1.AddItem "Option3"
        ComboBox1.AddItem "Option4"
        ComboBox1.AddItem "Option5"
    End Sub
    
    
    Private Sub ComboBox1_Change()
      Select Case ComboBox1.Value
    
    Case "Option1"
    Range("H:\Docs\CV Tracking.xlsx#sheet6!A1").Select
    
    Case "Option2"
    Range("H:\Docs\CV Tracking.xlsx#sheet21!A1").Select
    
    
    End Select
    End Sub
    but I've had no luck with either! Can anyone help?

    Thanks,

    Chris
    Last edited by chris2886; 02-19-2010 at 08:20 AM. Reason: forgot code tags

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Linking DropDown box options to worksheets

    Welcome to the Forum chris2886.

    However, your post does not comply with the Forum Rules you agreed to follow. Per Rule #3, all VBA code must be wrapped in code tags. Please edit your post to add the code tags, after which solutions to your question will be suggested.

    Rule #3
    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button. For more information about these and other tags, click here.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    02-19-2010
    Location
    Cambridge, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Linking DropDown box options to worksheets

    Sorry! Now corrected

  4. #4
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Linking DropDown box options to worksheets

    Hi chris2886

    Please can you confirm that the sheets you are refering to are in the same workbook.

    Thanks

  5. #5
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Linking DropDown box options to worksheets

    You may find this link helpful: Creating a Index Worksheet

    Try adapting the code and use it in a validation drop down instead of a control from Forms or Control Tool Box.

    Private Sub Worksheet_Activate()
    
    Dim wSheet As Worksheet
    
    Dim l As Long
    
    l = 1
    
    
    
        With Me
    
            .Columns(1).ClearContents
    
            .Cells(1, 1) = "INDEX"
    
            .Cells(1, 1).Name = "Index"
    
        End With
    
        
    
        For Each wSheet In Worksheets
    
            If wSheet.Name <> Me.Name Then
    
                l = l + 1
    
                    With wSheet
    
                        .Range("A1").Name = "Start_" & wSheet.Index
    
                        .Hyperlinks.Add Anchor:=.Range("A1"), Address:="", _
    
                        SubAddress:="Index", TextToDisplay:="Back to Index"
    
                    End With
    
                    
    
                    Me.Hyperlinks.Add Anchor:=Me.Cells(l, 1), Address:="", _
    
                    SubAddress:="Start_" & wSheet.Index, TextToDisplay:=wSheet.Name
    
            End If
    
        Next wSheet
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1