hide rows with zero balance

Discussion in 'Excel Programming' started by andresg1975, Jul 23, 2007.

  1. andresg1975

    andresg1975 Guest

    i have, lets say
    a b c d
    1 1 4 5 9
    2 8 0 8 7
    3 0 0 0 0
    4 7 8 5 9
    5 0 0 0 0
    6 5 8 7 4

    how can i hide rows where column a,b,c and d have zero balances
    In this case, hiding row 3 and 5
    Any help would be greatly appreciated
    andresg1975, Jul 23, 2007
    #1
    1. Advertising

  2. andresg1975

    Guest

    On 23 Jul, 17:24, andresg1975 <>
    wrote:
    > i have, lets say
    > a b c d
    > 1 1 4 5 9
    > 2 8 0 8 7
    > 3 0 0 0 0
    > 4 7 8 5 9
    > 5 0 0 0 0
    > 6 5 8 7 4
    >
    > how can i hide rows where column a,b,c and d have zero balances
    > In this case, hiding row 3 and 5
    > Any help would be greatly appreciated



    Try this for where your data is in cells B1 to E7:


    Dim rngHide As Range

    For Each rngHide In Range("A2:A7")
    If WorksheetFunction.Sum(rngHide.Offset(0, 1).Resize(1, 5)) = 0
    Then
    rngHide.EntireRow.Hidden = True
    End If
    Next rngHide



    Regards,

    Toyin
    , Jul 23, 2007
    #2
    1. Advertising

  3. andresg1975

    andresg1975 Guest

    It didn't work due to a syntax error in here:
    If WorksheetFunction.Sum(rngHide.Offset(0, 1).Resize(1, 5)) = 0


    "" wrote:

    > On 23 Jul, 17:24, andresg1975 <>
    > wrote:
    > > i have, lets say
    > > a b c d
    > > 1 1 4 5 9
    > > 2 8 0 8 7
    > > 3 0 0 0 0
    > > 4 7 8 5 9
    > > 5 0 0 0 0
    > > 6 5 8 7 4
    > >
    > > how can i hide rows where column a,b,c and d have zero balances
    > > In this case, hiding row 3 and 5
    > > Any help would be greatly appreciated

    >
    >
    > Try this for where your data is in cells B1 to E7:
    >
    >
    > Dim rngHide As Range
    >
    > For Each rngHide In Range("A2:A7")
    > If WorksheetFunction.Sum(rngHide.Offset(0, 1).Resize(1, 5)) = 0
    > Then
    > rngHide.EntireRow.Hidden = True
    > End If
    > Next rngHide
    >
    >
    >
    > Regards,
    >
    > Toyin
    >
    >
    andresg1975, Jul 23, 2007
    #3
  4. andresg1975

    Guest

    The syntax is due to you not having "Then" after the 0

    For some reason the text has wrapped to the next line in my reply.

    Let me know,

    Toyin.
    , Jul 24, 2007
    #4
  5. andresg1975

    andresg1975 Guest

    Thanks a lot for your help!

    "" wrote:

    > The syntax is due to you not having "Then" after the 0
    >
    > For some reason the text has wrapped to the next line in my reply.
    >
    > Let me know,
    >
    > Toyin.
    >
    >
    andresg1975, Jul 25, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg

    opening balance - closing balance

    Greg, May 15, 2004, in forum: Access General
    Replies:
    3
    Views:
    195
    Arvin Meyer
    May 16, 2004
  2. Nyla K
    Replies:
    2
    Views:
    100
    Nyla K
    Aug 3, 2005
  3. Jeff Boyce
    Replies:
    4
    Views:
    167
    Jeff Boyce
    Jun 19, 2006
  4. Nadine
    Replies:
    0
    Views:
    110
    Nadine
    Apr 16, 2007
  5. zhehol
    Replies:
    1
    Views:
    55
Loading...

Share This Page