+ Reply to Thread
Results 1 to 10 of 10

Show/Hide Empty rows/columns

  1. #1
    Registered User
    Join Date
    09-22-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    5

    Show/Hide Empty rows/columns

    Hi,

    In attached file you can see one sheet.

    I have two table and 6 buttons. With HRB (Hide Row Button) I want to hide empty rows or rows which different values but with empty "G" column. First HRB is functional, but I want to relate with another column ("H"). For example in this table I want to hide Excel rows: 6, 9-14, because calculation in G and H column are without value or zero. In VBA Module 1 are for rows.

    Second problem is with column button. With HCB (Hide Column Button) I want to hide column from 9-12 ("I" - "L"). In this case I want to hide only "J" column and not to hide "L" column, because this column is not empty in second table.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Show/Hide Empty rows/columns

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Show/Hide Empty rows/columns

    Hi, omfe,

    Please Login or Register  to view this content.
    Thereīs no way to hide columns in a given range - itīs EntireColumn according to EntireRow.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    09-22-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Show/Hide Empty rows/columns

    Thanks a lot,

    The second answer is what I want for hide rows, but I believe that exist solution for columns.

    For example
    Please Login or Register  to view this content.
    Last edited by Cutter; 09-23-2012 at 10:03 AM. Reason: Added code tags

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Show/Hide Empty rows/columns

    Hi, omfe,

    I would recommend to modify both the call and the function for SH_Column (I used constants for the starting and end rows of the ranges, these can be passed as parameter or be calculated if the upper left cell of the range is passed via CurrentRegion):

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    09-22-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Show/Hide Empty rows/columns

    Thanks again,

    I put your function in module 2 and work. I change only this row


    Columns(lngCount).Hidden = WorksheetFunction.CountA(rngToCheck) <= 0

    With this function only button ShCB (Show Column Button) didn't work.
    I hope this is a last question.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Show/Hide Empty rows/columns

    Hi, omfe,

    sorry but I was focused only on hiding the columns.

    Change both calls and function to:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    09-22-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Show/Hide Empty rows/columns

    Thanks a lot Holger,

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Show/Hide Empty rows/columns

    @ omfe

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  10. #10
    Registered User
    Join Date
    09-22-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Show/Hide Empty rows/columns

    Thanks Cutter

+ 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