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
Bookmarks