+ Reply to Thread
Results 1 to 8 of 8

Hide/unhide cells within range

  1. #1
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Hide/unhide cells within range

    Hi all,

    Thanks to this forum I managed to name sheets within a range (between the sheets "Start" and "End") yesterday.

    Now I'm trying to hide/unhide the same sheet range with a button, using below code, but it doesn't work.

    Please Login or Register  to view this content.
    Any idea how to correct this?

    In a dream world it would be activated by a button where you simply click either choice, something like this [ O Hide O Unhide ]

    Many thanks in advance.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,884

    Re: Hide/unhide cells within range

    How about
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Re: Hide/unhide cells within range

    Once again you are the man, many thanks!

    A follow up question though. When I insert an Option Button, I only get one option box and when click it hides the sheets (so far so good). Clicking it again obviously does not unhide them. How would I assign a dual box option button showing hide/unhide?

    Thanks a lot.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,884

    Re: Hide/unhide cells within range

    If you assign the macro to a Forms control option button, it will hide/unhide everytime you click the button.
    Another option would be to use a Shape

  5. #5
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Re: Hide/unhide cells within range

    I played around with it and a single option button actually reverse current status. Ie, if all sheets are shown and I click the button all sheets become hidden. If all sheets are hidden and I click the button all sheets become unhidden. But if one or more sheets are hidden or not hidden as compared to the rest of the sheets, by clicking the button they just reverse, ie those that were hidden flips to unhidden and vice versa.

    Would it be possible to change the code to only hide sheets when clicking the button? And then another one where it only unhides any unhiddden sheets?

    Many thanks!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,884

    Re: Hide/unhide cells within range

    To unhide sheets use
    Please Login or Register  to view this content.
    and change xlSheetVisible to xlSheetHidden to hide them

  7. #7
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Re: Hide/unhide cells within range

    That worked, you're a life saver!

    Thanks for all your help.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,884

    Re: Hide/unhide cells within range

    You're welcome & thanks for the feedback

+ 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] hide/unhide a range toggle
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2016, 03:54 PM
  2. Hide/Unhide Column Range
    By karlosdejackal in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2015, 03:19 PM
  3. Hide/Unhide Range of Cells using Hyperlink
    By Makkers31 in forum Excel General
    Replies: 2
    Last Post: 04-25-2014, 11:13 AM
  4. Hide/Unhide Cells based on a Date Range
    By burdettejj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2014, 05:01 AM
  5. [SOLVED] First unhide all rows - then hide rows based on specific cell value for a range of cells
    By robbiekh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2013, 05:46 PM
  6. [SOLVED] Hide unhide range
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-08-2013, 10:35 AM
  7. [SOLVED] Checkbox to hide/unhide named range
    By Joel Mills in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-25-2005, 12:06 PM

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