+ Reply to Thread
Results 1 to 10 of 10

Hide/Unhide rows dependent on value (0 or blank)

  1. #1
    Registered User
    Join Date
    01-07-2016
    Location
    Croatia
    MS-Off Ver
    2013
    Posts
    8

    Hide/Unhide rows dependent on value (0 or blank)

    I would like to create a toggle button that would hide/unhide complete rows depending on the values in a column.
    If a value in the cell and column are zero or are leaved blank the rows should be hidden when the button is pressed.

    Please help me with this, this is the first time I try to use a VB script in excel, so I'm a complete rookie.

    Thanx in advance,
    Las

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Hide/Unhide rows dependent on value (0 or blank)

    Try this code (assuming that range("A1:A" & LastRow in column A)
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Hide/Unhide rows dependent on value (0 or blank)

    Assume your criteria is in column B, then

    Please Login or Register  to view this content.
    to unhide
    Please Login or Register  to view this content.
    Last edited by alansidman; 01-07-2016 at 09:00 AM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    01-07-2016
    Location
    Croatia
    MS-Off Ver
    2013
    Posts
    8

    Re: Hide/Unhide rows dependent on value (0 or blank)

    alansidman, your code seems to work when I run it, but I can't add it to the toggle button... Most likely I just don't know how, I'm really just getting started using VB codes,,,

    Edit> And It won't unhide, only hide the 0 and blank cells

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Hide/Unhide rows dependent on value (0 or blank)

    I've modified to one code.

    Please Login or Register  to view this content.
    Last edited by alansidman; 01-07-2016 at 09:12 AM.

  6. #6
    Registered User
    Join Date
    01-07-2016
    Location
    Croatia
    MS-Off Ver
    2013
    Posts
    8

    Re: Hide/Unhide rows dependent on value (0 or blank)

    can it be somehow compiled into one toggle button?

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Hide/Unhide rows dependent on value (0 or blank)

    I've modified in Post #5

  8. #8
    Registered User
    Join Date
    01-07-2016
    Location
    Croatia
    MS-Off Ver
    2013
    Posts
    8

    Re: Hide/Unhide rows dependent on value (0 or blank)

    the code runs great! now comes the noob question > Do I need to copy this code between "private Sub ToggleButton1_Click () and End Sub", or how do I make it run by clicking on the toggle button?

    Thanx in advance for all the help

  9. #9
    Registered User
    Join Date
    01-07-2016
    Location
    Croatia
    MS-Off Ver
    2013
    Posts
    8

    Re: Hide/Unhide rows dependent on value (0 or blank)

    I figured it out, thanks for the great code bro! :D

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Hide/Unhide rows dependent on value (0 or blank)

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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 or Unhide sheets dependent on a cell value
    By stevebudd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2015, 12:00 PM
  2. Need Toggle Button to hide/unhide rows based on cell value in non concurrent rows
    By The Phoenix in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-13-2015, 10:49 AM
  3. [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
  4. [SOLVED] macro to hide rows if cell is blank, unhide if it contains text
    By Russ Fuquay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 10:02 PM
  5. [SOLVED] Hide unhide blank rows?
    By jeff p in forum Excel General
    Replies: 6
    Last Post: 04-03-2012, 09:48 AM
  6. Macro to unhide rows dependent on picklist text
    By gazzz_tha1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2010, 05:03 PM
  7. Excel 2007 : Hide/Unhide blank rows assigned to a check-box
    By Prof-pat-pending in forum Excel General
    Replies: 10
    Last Post: 09-05-2009, 03:50 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