View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Hide row if particular cells are empty

Assuming the cells are actually blank and NOT just look blank with a formula
of type =if(true,"","abc")

Sub HideRows()
Dim rng As Range, rng1 As Range
Dim ar As Range. rw as Range
Rows.Hidden = False
Set rng = Intersect(ActiveSheet.UsedRange, ActiveSheet.Columns(4).Resize(,
4))
Set rng1 = rng.SpecialCells(xlBlanks)
For Each ar In rng1.Areas
For Each rw In ar.Rows
If rw.Cells.Count = 4 Then
rw.EntireRow.Hidden = True
End If
Next
Next
End Sub


--
Regards,
Tom Ogilvy




"Francis Hookham" wrote in message
...
Text can be in none, any or all of the cells of columns 4, 5, 6 and 7 in
each row.



I need to hide the row only if all cells 4, 5, 6 and 7 are empty but leave
the row visible if any cell includes text.



I just cannot see how to do it - everything else is ok - determining the
number of rows which vary and progressing from row to row - it is just the
test in each row I need help with.



Best wishes for 2007 - another hour to go here in the UK.



Francis Hookham