+ Reply to Thread
Results 1 to 6 of 6

Macro to Hide/Unhide Cells

  1. #1
    Registered User
    Join Date
    08-07-2016
    Location
    Edmond, Oklahoma
    MS-Off Ver
    2010
    Posts
    15

    Macro to Hide/Unhide Cells

    I am wanting to create a macro (that will be attached to a button) where I can hide/unhide rows based on if they have a zero value in a certain column. I have attached an example workbook which shows two separate value sets (rows 10-30 and 34-59) where if there is zero value in column G, I want to be able to run the macro to hide the rows with a zero. I also want to be able to run the same macro to unhide, so sort of like an on/off switch.

    Any help creating this macro would be greatly appreciated!

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro to Hide/Unhide Cells

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-07-2016
    Location
    Edmond, Oklahoma
    MS-Off Ver
    2010
    Posts
    15

    Re: Macro to Hide/Unhide Cells

    Hey Greg!

    This seems to have worked perfectly, just as I wanted. Thanks for the input on this!

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro to Hide/Unhide Cells

    Hi again,

    Many thanks for your very prompt feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

  5. #5
    Registered User
    Join Date
    08-07-2016
    Location
    Edmond, Oklahoma
    MS-Off Ver
    2010
    Posts
    15

    Re: Macro to Hide/Unhide Cells

    Greg, I appreciate the original input. I have an updated workbook with an additional column (Column K). Taking the original solution provided above, is there a way to say if either the cells in Column G or Column K are zero to hide/unhide?
    Attached Files Attached Files
    Last edited by Corby10; 02-08-2023 at 03:42 PM.

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro to Hide/Unhide Cells

    Hi again,

    Sorry about the delay in getting around to this.

    The "PerformToggle" routine has been rewritten as shown below, and appears to do what you need.

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

+ 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. Hide/unhide rows checkbox hide but doesn't unhide
    By windzor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2021, 11:51 AM
  2. Hide/Unhide Cells
    By mandy03 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-13-2018, 06:02 PM
  3. [SOLVED] Macro for Hide blank rows and Unhide the rows with cells
    By Neilesh Kumar in forum Excel General
    Replies: 4
    Last Post: 04-12-2017, 06:06 AM
  4. Macro Merging VBA how to hide and unhide two groups of cells
    By Lmao in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2017, 02:49 PM
  5. Hide Visibility hide and unhide menu using macro ?
    By jasond1992 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-30-2015, 09:05 PM
  6. Macro to hide/unhide cells not running or running slow
    By mbp727 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2013, 04:22 PM
  7. macro to hide/unhide cells
    By aviflux in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2008, 10:37 AM

Tags for this Thread

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