+ Reply to Thread
Results 1 to 19 of 19

Hide Rows with Zero Value

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

    Hide Rows with Zero Value

    I'm looking for a way to hide a row if it has a zero value in a specific column.

    I've attached a sample workbook where, in rows 9-81, I want a row to be hidden if it has a zero value in column F. Ideally I could use a button to make the rows appear again when needed.
    Attached Files Attached Files

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Hide Rows with Zero Value

    try like this:

    Please Login or Register  to view this content.
    assign to any button.
    Attached Files Attached Files
    Last edited by KOKOSEK; 12-17-2019 at 01:03 PM.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

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

    Re: Hide Rows with Zero Value

    Thanks for the response. This is allowing me to hide the rows with the button but when I click the button again, the rows do not unhide. Is there a way to do this?

  4. #4
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Hide Rows with Zero Value

    Is not unhide because still the same rows have zero in F.
    I've added other button to show all.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Hide Rows with Zero Value

    Are you required to use VBA for this? My first thought is to set up a simple filter on the spreadsheet. https://www.wikihow.com/Use-AutoFilter-in-MS-Excel Then, when you want to hide the 0 values, simply click on the dropdown arrow for column F and deselect the 0 values. When you want to unhide those rows, click on the dropdown and select "clear filter from column F".
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

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

    Re: Hide Rows with Zero Value

    Quote Originally Posted by MrShorty View Post
    Are you required to use VBA for this? My first thought is to set up a simple filter on the spreadsheet. Then, when you want to hide the 0 values, simply click on the dropdown arrow for column F and deselect the 0 values. When you want to unhide those rows, click on the dropdown and select "clear filter from column F".
    Yes, I'd like a button to make it a little cleaner for presentation purposes. It would be ideal to have it as one button. This is what I've used before to do the same but hortizontally, so I figured I could find a way to translate this into the vertical hiding.

    Please Login or Register  to view this content.
    Last edited by Corby10; 12-17-2019 at 01:33 PM.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Hide Rows with Zero Value

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    Re: Hide Rows with Zero Value

    Thanks for the guidance. I've updated the post.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Hide Rows with Zero Value

    Thank you.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Hide Rows with Zero Value

    It would be ideal to have it as one button

    Please Login or Register  to view this content.
    Last edited by sintek; 12-17-2019 at 02:03 PM. Reason: simplified code
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

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

    Re: Hide Rows with Zero Value

    This works but shows the filter drop down arrow. In a perfect world, there wouldn't be the filter arrow.

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

    Re: Hide Rows with Zero Value

    Just make this change to Sintek's code
    Please Login or Register  to view this content.
    Last edited by Fluff13; 12-17-2019 at 03:49 PM.

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

    Re: Hide Rows with Zero Value

    That change didn't hide any rows.

    KOKOSEK's original post is exactly what I am needing aside from it not reversing the action when I click it again.
    Last edited by Corby10; 12-17-2019 at 03:51 PM.

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

    Re: Hide Rows with Zero Value

    Oops, it should be
    Please Login or Register  to view this content.

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

    Re: Hide Rows with Zero Value

    Thanks Fluff, anyway to stop it at a certain row, like 79?

  16. #16
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Hide Rows with Zero Value

    Here you go:

    Please Login or Register  to view this content.
    under 1 button.
    Attached Files Attached Files

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

    Re: Hide Rows with Zero Value

    I cannot get that to work either. My button is named Hide/Unhide if that makes any difference.

  18. #18
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Hide Rows with Zero Value

    Try this. I've changed button type.
    The rest of code is the same.
    Attached Files Attached Files

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

    Re: Hide Rows with Zero Value

    Thanks for the help. I'm going to just go with the two button approach. I appreciate your work on this.

+ 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 chart when I hide rows
    By L.LEE in forum Excel General
    Replies: 1
    Last Post: 08-29-2018, 03:32 AM
  2. Hide Rows/Hide Columns Based on Value in Cell
    By brickwall823 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2015, 02:42 PM
  3. [SOLVED] Hide specific Rows in Sheet1 + hide 5 more in Sheet2
    By bluesurger in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 06-02-2014, 07:19 AM
  4. [SOLVED] Hide - Un Hide rows with empty columns
    By BDF in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-14-2014, 02:09 PM
  5. Hide Rows with a Value (2 values to hide) then delete visible rows
    By Slea in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-19-2013, 06:25 AM
  6. Using check boxes to hide and un-hide rows with drop down lists within rows
    By Sparky_Chris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2012, 07:22 AM
  7. HIDE ZEROS IN CHART - Hide rows of cells that equals zero
    By sweedey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2011, 08:18 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