View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How do I auto hide a row if a condition isnt met?

Autofilter is pretty easy to use, but I guess you could try a macro.

Sub HideBlank_Zeros_Rows()
'using set column B
Dim RngCol As Range
Dim I As Range
Set RngCol = Range("B1", Range("B" & Rows.Count). _
End(xlUp).Address)
For Each I In RngCol
If I.Value = "" Or I.Value = "0" Then _
I.entirerow.Hidden = True
Next I
End Sub

Adjust for your "certain conditions"


Gord Dibben MS Excel MVP

On Fri, 3 Apr 2009 13:12:13 -0700, Brian
wrote:

I have a MS Query data being returned to Excel and I want to evaluate certain
conditions of that data. Based on those conditions I want to display a row
or hide it so I can directly print my worksheet without resorting or turning
on autofilter.