+ Reply to Thread
Results 1 to 8 of 8

How to auto hide/unhide rows based on value of sum

  1. #1
    Registered User
    Join Date
    12-23-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    7

    Question How to auto hide/unhide rows based on value of sum

    Hi all, complete VBA newb here. I've searched through the forum but can't seem to find exactly what I'm looking for, and am hoping the smart people here can help me out. I have a table that changes based on the input of another cell "C1". I would like the table to hide rows where the sum (column O), returns a value of 0. I would also like it to unhide when a previously hid row now has a value >0, and have it do all this based on the event of changing the value of C1. I'm on Excel 2010. I've tried various codes I've found out there, but nothing quite works.

    Thanks in advance for your help!

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to auto hide/unhide rows based on value of sum

    Place this code under the sheet module.

    I did not debug it too much because I didnt have a sample but I think this should work.

    Please Login or Register  to view this content.
    Thanks

  3. #3
    Registered User
    Join Date
    12-23-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to auto hide/unhide rows based on value of sum

    That seemed to work, but it's causing my excel to crash because it seems it's unhiding everything after the table, which is all empty rows. How can I modify this code to stop after a certain row? I only have this table from rows 48 to 145, so How can I tell it to stop after O145? THANK YOU SO MUCH!

    EDIT: Received the following error "Method 'Hidden' of object 'Range' failed
    Last edited by wesleeptheylive; 12-23-2013 at 02:23 PM.

  4. #4
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to auto hide/unhide rows based on value of sum

    This is the modified one.

    Please Login or Register  to view this content.
    I am glad I was able to help. If you are satisfied with my response please give some reputation.

  5. #5
    Registered User
    Join Date
    12-23-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to auto hide/unhide rows based on value of sum

    This does exactly what I need it to do, I thank you very much. Have another question on the code: The code runs when you click on any cell, not just C1. Is it supposed to run like this? C1 is a drop down list, so ideally the code would run after you select something from the drop down list in C1. Thanks Again! +repped

  6. #6
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to auto hide/unhide rows based on value of sum

    I am sorry I was using the wrong event.

    Please Login or Register  to view this content.
    Thanks

  7. #7
    Registered User
    Join Date
    12-23-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to auto hide/unhide rows based on value of sum

    This worked perfectly, thanks!

  8. #8
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to auto hide/unhide rows based on value of sum

    O am glad I was able to help

+ 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] Auto Hide and Unhide Rows Based
    By Kosmik in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-05-2013, 10:09 AM
  2. Auto Hide/Unhide rows in Excel based on radio button selection
    By awill110 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2013, 03:05 PM
  3. Auto Hide/Unhide rows in Excel based on formula result in a column
    By crozierk in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-12-2012, 08:02 AM
  4. Auto hide/unhide based on input
    By UnSpoknOne in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-03-2011, 06:11 PM
  5. Auto Hide or Unhide rows.
    By Michael S in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2009, 06:04 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