+ Reply to Thread
Results 1 to 6 of 6

Auto hide unused rows, automatic update

  1. #1
    Registered User
    Join Date
    05-04-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2011 OSX Home, Excel 2010 Home, Excel 2002 SP3 Work
    Posts
    29

    Auto hide unused rows, automatic update

    Hi,

    I have a VBA-code that I want to modify. The code hides all unused rows and it lets you select starting column and row. I have assigned the macro to a clickable box, so whenever I click the box the unused rows get hidden. However, I would like to make it so that the unused rows automatically get hidden without the need to button pressing, and get unhidden when a row no longer is empty. I would also like to add some rows to be ignored and thus always be shown.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,413

    Re: Auto hide unused rows, automatic update

    How will "get unhidden when a row no longer is empty"? If you can't see the row, how are you going to put anything in it? Or am I missing something?

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    05-04-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2011 OSX Home, Excel 2010 Home, Excel 2002 SP3 Work
    Posts
    29

    Re: Auto hide unused rows, automatic update

    Quote Originally Posted by TMShucks View Post
    How will "get unhidden when a row no longer is empty"? If you can't see the row, how are you going to put anything in it? Or am I missing something?

    Regards
    I have a drop down list with different brands on B1. On A1:A13 I have measurements, like shoe size on A2 and color on A3. If I pick pants in B1, A2 will be empty. And if I repick shoes in B1, A2 will not be empty. I want the macro to kick in everytime I pick something on a drop down list and hide the unused rows.

  4. #4
    Registered User
    Join Date
    05-05-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Auto hide unused rows, automatic update

    Hi Ranew,

    As a workaround, what I would recommend you is to:
    - Create a column called (for example) SUM_ALL where it would contain the sum of the values from columns A to Z
    - Then use the Worksheet_Change event in the sheet you want to do that. In that event you would re-apply a filter where SUM_ALL <> 0

    See example below (considering your table is from A1 to Z:1000, for example. And that the SUM_ALL column is AA, but you can adjust that using your Const). Please notice the code below will have to be inside the sheet with that filter:

    Please Login or Register  to view this content.

    Good luck

  5. #5
    Registered User
    Join Date
    05-04-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2011 OSX Home, Excel 2010 Home, Excel 2002 SP3 Work
    Posts
    29

    Re: Auto hide unused rows, automatic update

    Thank you for your suggestion inesi. Will your method automatically hide/unhide whenever a row is empty? I also have words, numbers, strings of text and hyperlinks on the rows, will a sum all still work?

  6. #6
    Registered User
    Join Date
    05-05-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Auto hide unused rows, automatic update

    Hi Ranew, thank you for the clarification. In this case you are right, the sum won't work. What you can do instead is to have it replaced by functions like COUNTA (to count non empty cells) or CONCATENATE. The main idea behind the SUM_ALL column is to have a column where it can set if the columns A to Z are empty so the filter and macro can work. Try that and let us know.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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