+ Reply to Thread
Results 1 to 3 of 3

Hide entire row only when all values in noncalculated cells are zero

  1. #1
    Registered User
    Join Date
    06-26-2013
    Location
    Times Square
    MS-Off Ver
    Excel 2010
    Posts
    4

    Hide entire row only when all values in noncalculated cells are zero

    Hello all,

    Unfortunately, I don't have any sound experience in VBA and I desperately need some assistance.

    Here's some background -
    Our PeopleSoft users run nVision reports using a layout (Excel file with .xnv extension) and would like a macro created to hide an entire row if all cells in the row are zero. This macro should then be added to an instance hook so it can be triggered when the report is run. Also, there are formulas in some cells, therefore I'm guessing that the code should have to look at non-contiguous cells.

    Here is some code that I tried initially. The problem is that it hid the entire row even when some cells were greater than zero.

    Sub HideRows()
    Dim cell As Range
    For Each cell In Range("G10:AB10")
    If Not isEmpty(cell) Then
    If cell.Value = 0 Then
    cell.EntireRow.Hidden = True
    End If
    End If
    Next
    End Sub

    Another challenge is that for some months there may be more data rows than what the layout displays, if that makes any sense. For example, the total row of the layout is on row 68. However, when I ran the report for June 2015, the report had 98 rows.

    I have attached the layout file for your reference; however, the website would not allow me to add it in .xnv format, so I added it as an Excel file.

    Thanking you in advance for your guidance and assistance.

    Best regards,
    Simone
    Attached Files Attached Files

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Hide entire row only when all values in noncalculated cells are zero

    try the following code:
    Please Login or Register  to view this content.
    From you own code, I assumed you were interested only in columns G to AB.
    If not, you can change it in the code to scan the columns you need to.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    06-26-2013
    Location
    Times Square
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Hide entire row only when all values in noncalculated cells are zero

    Thank you, p24leclerc. I will give this a try!

+ 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. If side by side cells are both 0, then hide entire row
    By tombarberio in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-28-2014, 02:32 PM
  2. copy entire excell sheet cells values into string array
    By laltoo2405 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2014, 09:17 PM
  3. [SOLVED] Macro to hide entire columns within range if cells within range are blank
    By graphicgoose in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2013, 08:26 PM
  4. Hide and insert rows when cells values are met
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2013, 08:07 PM
  5. Replies: 3
    Last Post: 11-06-2012, 11:26 AM
  6. [SOLVED] search in the entire sheet for different letter and cal.-sum the values of the cells
    By Peter FS in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-18-2005, 07:05 PM
  7. [SOLVED] How do I just update values on several cells (not the entire works
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2005, 01:06 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