+ Reply to Thread
Results 1 to 5 of 5

Unhiding All hidden Worksheets with a Macro/VBA Code

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Unhiding All hidden Worksheets with a Macro/VBA Code

    Hi,

    Can anyone help me please ?

    Whilst working with an Excel Workbook I often hide all unwanted Worksheets leaving only the ones I need to work on visible.

    What I would like to do is have a macro or VBA code to click on a button to unhide all hidden worksheets rather repeating Format-Sheet-Unhide to unhide each worksheet.

    Any help would be greatly appreciated (Excel version Excel 2000)


    Many thanks

    Rob
    Rob

  2. #2
    bigwheel
    Guest

    RE: Unhiding All hidden Worksheets with a Macro/VBA Code

    Try this

    Dim mySheet As Worksheet
    For Each mySheet In Worksheets
    mySheet.Visible = True
    Next mySheet


    "robertguy" wrote:

    >
    > Hi,
    >
    > Can anyone help me please ?
    >
    > Whilst working with an Excel Workbook I often hide all unwanted
    > Worksheets leaving only the ones I need to work on visible.
    >
    > What I would like to do is have a macro or VBA code to click on a
    > button to unhide all hidden worksheets rather repeating
    > Format-Sheet-Unhide to unhide each worksheet.
    >
    > Any help would be greatly appreciated (Excel version Excel 2000)
    >
    >
    > Many thanks
    >
    > Rob
    >
    >
    > --
    > robertguy
    >
    > 44 Married two kids
    > ------------------------------------------------------------------------
    > robertguy's Profile: http://www.excelforum.com/member.php...fo&userid=5963
    > View this thread: http://www.excelforum.com/showthread...hreadid=490133
    >
    >


  3. #3
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Thumbs up It Works

    It Works

    Many thanks to bigwheel !!

    Rob

  4. #4
    Registered User
    Join Date
    02-23-2012
    Location
    Gujarat
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Unhiding All hidden Worksheets with a Macro/VBA Code

    You can try following to hide, change the sheetName according to your requirement.


    Sub UnHideThem()

    For Each sh In ThisWorkbook.Worksheets
    If Not sh.Name = "SheetName" Then sh.Visible = True
    Next sh

    End Sub


    If you want to have a macro created to hide all worksheets, use following code in your macro module.


    Sub HideThem()

    For Each sh In ThisWorkbook.Worksheets
    If Not sh.Name = "Access_Control" Then sh.Visible = False
    Next sh

    End Sub


    Do let me know if this helps.

  5. #5
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Re: Unhiding All hidden Worksheets with a Macro/VBA Code

    milindesai

    many thanks for yot reply, the 'UnHideThem' macro works as requested but unfortunately the 'HideThem' hides all but one sheet and then reports an error message i.e. Run-time error '1004': Unable to set the visible property of the Worksheet class.


    Do you have any ideas how to resolve this error message


    Many thanks


    Rob

+ 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