Re: How to hide rows based on cell values in two columns
Hi: I have basically the same question.
Worksheet has data in Columns A through L
Columns E and L contain dollar figures in rows 52 through 77. The cells are pre-loaded with zero dollars with anticipation that some of the zeros will be changed by the user.
If BOTH the values in Column E & L remain as Zero, I want to Hide the entire row. The Macro below stops working after it looks at the first row and will not continue to loop.
Any ideas? I think my If then statement is wrong???
Sub HideRows() With Range("E52:E57", "L52:L57") .EntireRow.Hidden = False For i = 1 To .Rows.Count If WorksheetFunction.Sum(.Rows(i)) = 0 Then .Rows(i).EntireRow.Hidden = True End If Next i End With End Sub
Note that if I were only looking at Column E without a need to column L, the above macro will work with a change to the Range at ("E52:E77"), but when I ask Excel to analyze Two Columns, E & L, or two values in the same row, I have the issue.