View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
robzrob robzrob is offline
external usenet poster
 
Posts: 159
Default Hide Row If Any Cell In It = 0

On Jan 30, 8:16*pm, "Per Jessen" wrote:
Hi

Try this:

Sub aaa()
Dim targetRange As Range
Dim tRange As Range
Application.ScreenUpdating = False
Set targetRange = Range("A1:J100")
For Each r In targetRange.Rows
* * Set tRange = targetRange.Rows(r.Row)
* * For Each cell In tRange.Cells
* * * * If cell.Value = 0 Then
* * * * * * Rows(cell.Row).Hidden = True
* * * * * * Exit For
* * * * End If
* * Next
Next
Application.ScreenUpdating = True
End Sub

Regards,
Per

"robzrob" skrev i ...



Hello All


Searched high and low amongst the forums for this and found some close
solutions, but can't seem to make any work.


I have Rows 1-100 & Cols A-J all with formulas or text in them. *If
the result of any of the formulas in any of the that range is 0, I
want the entire row hidden.


Cheers- Hide quoted text -


- Show quoted text -



Thanks. But it comes to a halt on: If cell.Value = 0 Then Perhaps I
should say that some of the cell values currently return #REF! (but
normally they would either be text or 0 or blank and also that I don't
want to test for blank or "", only 0.