+ Reply to Thread
Results 1 to 4 of 4

Hide Row if result of a forumla is Zero

Hybrid View

  1. #1
    Registered User
    Join Date
    05-08-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    8

    Hide Row if result of a forumla is Zero

    Hi

    VBA Noob posted the below script to hide rows if the value of a cell is zero. I would like to hide a row if the result of a formula is zero. When I use this, it's hiding all rows other than those that are blank.

    Sub HideBlankRows()
    Dim Last As Long
    Dim Rng, c As Range
    Last = Cells(Rows.Count, "AF").End(xlUp).Row
    Set Rng = Range("AF9:AF" & Last)
    Application.ScreenUpdating = False
    For Each c In Rng
    If c.Value = "0" Then
    c.EntireRow.Hidden = True
    End If
    Next c
    Application.ScreenUpdating = True
    End Sub
    Last edited by vlady; 01-07-2013 at 10:51 PM. Reason: code tags

  2. #2
    Registered User
    Join Date
    12-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Hide Row if result of a forumla is Zero

    Try this instead for the if line:

    If c.Value = "0" AND c.HasFormula = True Then
    regards

    J450n

  3. #3
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Hide Row if result of a forumla is Zero

    Hi

    Check this. I have used dummy data.

    hiderowwithzero.xlsm
    Click *, if my suggestion helps you. Have a good day!!

  4. #4
    Registered User
    Join Date
    05-08-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide Row if result of a forumla is Zero

    Hi All

    Thanks for your posts. I got the orginal one to work in the end.

+ 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