Solved

Displaying Hidden sheets in a dropdown?

Posted on 2014-01-18
2
256 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

910 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

21 Experts available now in Live!

Get 1:1 Help Now