ATTENTION!! ... We just launched this forum recently, so not much is on it yet. JOIN TODAY!

Excel - Dropdwown List to go to Sheets

Everything that has to to do with computer programming in languages not mentioned above.
Post Reply
User avatar
Site Admin
Posts: 50
Joined: Mon Apr 08, 2019 2:20 pm

Excel - Dropdwown List to go to Sheets

Post by PixelinkMedia » Sun May 05, 2019 1:39 pm

Here is some VBA code to use in Excel if you want a dropdown list that allows you to go to any sheet in your workbook.

You need to add a dropdown control (on Developer tab) to the sheet, then go into the Visual Basic editor and add this code for the sheet

Code: Select all

Private Sub ComboBox1_Change()
'Updateby Extendoffice
    If ComboBox1.ListIndex > -1 Then Sheets(ComboBox1.Text).Select
End Sub
Private Sub ComboBox1_DropButtonClick()
    Dim xSheet As Worksheet
    On Error Resume Next
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    If ComboBox1.ListCount <> ThisWorkbook.Sheets.Count Then
        For Each xSheet In ThisWorkbook.Sheets
            ComboBox1.AddItem xSheet.Name
        Next xSheet
    End If
    Application.EnableEvents = True
    Application.ScreenUpdating = True
End Sub
Private Sub ComboBox1_GotFocus()
    If ComboBox1.ListCount <> 0 Then ComboBox1.DropDown
End Sub

My Site: Pixelink Media • Windows 7 • 10G RAM • NIV-GForce GT 640 Graphics Card
Affinity (Designer/Photo/ • CorelDraw • Blender • HitFilm • Saola (web animation/interactive) • MagicaVoxel
Lazarus (Free Pascal) • .NET Framework (discontinued for now) • PHP • Html/CSS • Javascript • mySQL/SQLite
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest