View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Santa-D Santa-D is offline
external usenet poster
 
Posts: 34
Default Macro to hide rows based on criteria

On Jul 1, 4:00*pm, Santa-D wrote:
Thanks Jarek & Mike,

I was on the verge of using the xlUp but I've got a series of blank
rows in between each of the categories.
I ended up using a modified version of the with selection...

"E" for expense & "R" for revenue. *If the value was "" then it would
skip and if it was "H" for Heading then it would be fine.

Sub hideeeee()
On Error Resume Next
For Each cell In Selection
If cell.Offset(0, -2) = "R" Or cell.Offset(0, -2) = "E" Then
* * If cell.Offset(0, 4) = 0 And cell.Offset(0, 5) = 0 _
* * * And Len(cell.Offset(0, 4)) 0 And Len(cell.Offset(0, 5)) 0
Then
cell.Rows.EntireRow.Hidden = True
End If
End If
Next cell

End Sub


The only downside is that it didn't keep the highlight second row
conditional formatting when hiding all those rows....... :)