Results 1 to 9 of 9

How to hide a row based on multiple cell values

Threaded View

csh8428 How to hide a row based on... 08-06-2012, 01:40 PM
arlu1201 Re: How to hide a row based... 08-06-2012, 02:30 PM
csh8428 Re: How to hide a row based... 08-06-2012, 04:45 PM
arlu1201 Re: How to hide a row based... 08-07-2012, 08:04 AM
csh8428 Re: How to hide a row based... 08-07-2012, 02:36 PM
csh8428 Re: How to hide a row based... 08-07-2012, 04:28 PM
arlu1201 Re: How to hide a row based... 08-08-2012, 09:43 AM
csh8428 Re: How to hide a row based... 08-08-2012, 10:00 AM
arlu1201 Re: How to hide a row based... 08-08-2012, 10:02 AM
  1. #1
    Registered User
    Join Date
    05-16-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    63

    How to hide a row based on multiple cell values

    I've tried several approaches on how to code this, but can't figure out how to work it. I have a large spreadsheet; which dynamically changes in both column and row counts. So, I have an array of values. If any cell has a negative value, that cell text needs to be changed to red AND that row needs to remain displayed. If ALL values in that row are >=0 then the row can be hidden.

    Not sure if this helps, but the array is actually a pivot table named QTD

    For Example: If cell D5 = 5 and F5 = -3 then Row 5 should remain displayed.
    If Cell D6 = 5 and F6=0 then row 6 should be hidden because all values are > 0

    My approach was to create a dynamically changing named range like so
       ActiveWorkbook.Names.Add Name:="RANGE2", RefersToR1C1:= _
            "=OFFSET(YTD_>_QTD!R3C1,0,0,COUNTA(YTD_>_QTD!C1),100)"
        ActiveWorkbook.Names("RANGE2").Comment = ""
    Here's a short example of the data

    Person Amnt1 Amnt2 Amnt 3
    1 5 -7 0
    2 10 0 10
    3 15 0 9
    4 20 9 -2

    Rows 2 and 3 should be hidden because all values in those rows are > 0. Rows 1 and 4 shoudl remain visible and Cell B2 and C5 should be red.


    Then I was thinking of using the case statement to hide the rows but can't figure the syntax. I'm open to any other means of performing the taks as long as the initial array dynamically to encompass all the data.


    Thanks,
    Craig
    Last edited by csh8428; 08-06-2012 at 04:44 PM.

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