Solved

Displaying Hidden sheets in a dropdown?

Posted on 2014-01-18
2
246 Views
Last Modified: 2014-01-19
I have  userform the displays a dropdown with all the sheet tabs in a workbook, however it shows the hidden ones too.  Is there a way to edit below so that hidden sheet tabs are not in the list?  Please advise and thanks. -R-


Option Explicit

Private Sub cmdGoTo_Click()
    If cboSheets.ListIndex <> -1 Then
        Application.Goto Worksheets(cboSheets.Value).Range("A1")
        Unload Me
    End If
End Sub



Private Sub UserForm_Initialize()
Dim I As Long

    For I = 1 To Worksheets.Count
        cboSheets.AddItem Worksheets(I).Name
    Next I
End Sub

Open in new window

0
Comment
Question by:RWayneH
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39790627
Private Sub UserForm_Initialize()
Dim I As Long

    For I = 1 To Worksheets.Count
        if Worksheets(I).Visible=xlSheetVisible then
            cboSheets.AddItem Worksheets(I).Name
        end if
    Next I
End Sub
0
 

Author Closing Comment

by:RWayneH
ID: 39792022
Thanks. -R-
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article will show you how to use shortcut menus in the Access run-time environment.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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