+ Reply to Thread
Results 1 to 5 of 5

VBA MAcro for non-selected worksheets to be hidden

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    turkey
    MS-Off Ver
    Excel 2016
    Posts
    4

    Post VBA MAcro for non-selected worksheets to be hidden

    Hello dear friends,

    I've got several worksheet tabs in my workbook, I am currently selecting just 3 of them (out of 33 for example), I would like to hide all worksheets except the ones that I've selected (so it is vice-versa for hiding the selected ones).

    this is the code below I am trying express for the desired result (of course not working at all), if any of you experts could direct me a little bit, it'd be highly appreciated:


    Sub HidingUnSelectedSheets()

    Dim ws As Worksheet

    Sheets(Array("Sheet5", "Sheet6")).Select

    For Each ws In ThisWorkbook.Windows(1).SelectedSheets
    If Not ws Is Selected Then
    ws.Visible = False
    End If
    Next

    End Sub

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: VBA MAcro for non-selected worksheets to be hidden

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    12-12-2013
    Location
    turkey
    MS-Off Ver
    Excel 2016
    Posts
    4

    Re: VBA MAcro for non-selected worksheets to be hidden

    Thank you for your guidance and quick response.
    I'm actually ok with hiding the "selected" sheets, rather I was trying to hide the other sheets that were not cited in sheets(array).

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA MAcro for non-selected worksheets to be hidden

    Quote Originally Posted by vakbel View Post
    Hello dear friends,
    I would like to hide all worksheets except the ones that I've selected (so it is vice-versa for hiding the selected ones).
    Not really sure about it tough.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-12-2013
    Location
    turkey
    MS-Off Ver
    Excel 2016
    Posts
    4

    Re: VBA MAcro for non-selected worksheets to be hidden

    Thank you very much Jindon.

    It works just fine and perfectly.
    Really appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA for Ctrl+Home for all worksheets including hidden and Very hidden
    By Neilesh Kumar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-17-2018, 08:28 AM
  2. Replies: 0
    Last Post: 04-13-2018, 01:18 PM
  3. VBA Macro to show/hide hidden worksheets using drop down list
    By Tillybee in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-18-2017, 12:28 PM
  4. Macro to find and replace links in hidden worksheets
    By lottidotti in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-09-2013, 09:45 PM
  5. Unhiding All hidden Worksheets with a Macro/VBA Code
    By robertguy in forum Excel General
    Replies: 4
    Last Post: 06-13-2012, 12:37 PM
  6. I wish the macro as Very Hidden all selected sheet
    By JAmanow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2012, 03:30 PM
  7. [SOLVED] How do I detect hidden worksheets or hidden data on a worksheet?
    By Alice in forum Excel General
    Replies: 3
    Last Post: 08-08-2006, 08:10 AM

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