+ Reply to Thread
Results 1 to 4 of 4

Hide/Unhide Sheets Form

  1. #1
    Registered User
    Join Date
    02-07-2006
    Posts
    26

    Hide/Unhide Sheets Form

    Hi everyone, I'm trying to make a form with two listbox and fill them with all sheets in a workbook (visible and hidden). See below the code in form_activate line:

    Please Login or Register  to view this content.
    ...the problem is when I try to select a hidden sheet. How can I do ?
    Any idea is welcome.

    Thanks and Regards
    Daniel.

  2. #2
    Bob Phillips
    Guest

    Re: Hide/Unhide Sheets Form

    Dim x As Integer

    Application.ScreenUpdating = False

    For x = 1 To Sheets.Count
    If Sheets(x).Visible = xlSheetVisible Then
    lstvisible.AddItem (ActiveSheet.Name)
    Else
    lsthidden.AddItem (ActiveSheet.Name)
    End If
    Next x

    Application.ScreenUpdating = True


    --

    HTH

    Bob Phillips

    (replace xxxx in the email address with gmail if mailing direct)

    "dbarelli" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi everyone, I'm trying to make a form with two listbox and fill them
    > with all sheets in a workbook (visible and hidden). See below the code
    > in form_activate line:
    >
    >
    > Code:
    > --------------------
    >
    > Dim x As Integer
    > Dim vhojactiva As String
    >
    > Application.ScreenUpdating = False
    > vhojactiva = ActiveSheet.Name
    >
    > For x = 1 To Sheets.Count
    > Sheets(Array(x)).Select
    > If ActiveSheet.Visible = -1 Then
    > lstvisible.AddItem (ActiveSheet.Name)
    > Else
    > lsthidden.AddItem (ActiveSheet.Name)
    > End If
    > Next x
    > Sheets(vhojactiva).Select
    > Application.ScreenUpdating = True
    >
    > --------------------
    >
    >
    > ..the problem is when I try to select a hidden sheet. How can I do ?
    > Any idea is welcome.
    >
    > Thanks and Regards
    > Daniel.
    >
    >
    > --
    > dbarelli
    > ------------------------------------------------------------------------
    > dbarelli's Profile:

    http://www.excelforum.com/member.php...o&userid=31275
    > View this thread: http://www.excelforum.com/showthread...hreadid=567019
    >




  3. #3
    Tom Ogilvy
    Guest

    RE: Hide/Unhide Sheets Form

    there is no need to select the sheets (and no, you can't select a hidden sheet)

    Dim x As Integer
    Dim vhojactiva As String

    vhojactiva = ActiveSheet.Name

    For x = 1 To Sheets.Count
    If sheets(x).Visible = -1 Then
    lstvisible.AddItem sheets(x).Name
    Else
    lsthidden.AddItem sheets(x).Name
    End If
    Next x

    --
    Regards,
    Tom Ogilvy


    "dbarelli" wrote:

    >
    > Hi everyone, I'm trying to make a form with two listbox and fill them
    > with all sheets in a workbook (visible and hidden). See below the code
    > in form_activate line:
    >
    >
    > Code:
    > --------------------
    >
    > Dim x As Integer
    > Dim vhojactiva As String
    >
    > Application.ScreenUpdating = False
    > vhojactiva = ActiveSheet.Name
    >
    > For x = 1 To Sheets.Count
    > Sheets(Array(x)).Select
    > If ActiveSheet.Visible = -1 Then
    > lstvisible.AddItem (ActiveSheet.Name)
    > Else
    > lsthidden.AddItem (ActiveSheet.Name)
    > End If
    > Next x
    > Sheets(vhojactiva).Select
    > Application.ScreenUpdating = True
    >
    > --------------------
    >
    >
    > ...the problem is when I try to select a hidden sheet. How can I do ?
    > Any idea is welcome.
    >
    > Thanks and Regards
    > Daniel.
    >
    >
    > --
    > dbarelli
    > ------------------------------------------------------------------------
    > dbarelli's Profile: http://www.excelforum.com/member.php...o&userid=31275
    > View this thread: http://www.excelforum.com/showthread...hreadid=567019
    >
    >


  4. #4
    Registered User
    Join Date
    02-07-2006
    Posts
    26
    Many Thanks to all !!
    Daniel.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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