View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy[_6_] Doug Glancy[_6_] is offline
external usenet poster
 
Posts: 30
Default Creating a Hide Macro

Awoll,

This pair should get you what you want:

Sub hide_case()
Dim c As Range
For Each c In Worksheets("Sheet1").Range(Range("D1"),
Range("D65536").End(xlUp))
If c < "case" And c < "" Then
c.EntireRow.Hidden = True
End If
Next c
End Sub

Sub unhide()
Dim c As Range
For Each c In Worksheets("Sheet1").Range(Range("D1"),
Range("D65536").End(xlUp))
c.EntireRow.Hidden = False
Next c
End Sub

Unless you meant that the entire row had to be blank, not just the cell in
column D. That would require a little more code.

hth,

Doug

"Awoll" wrote in message
...
Hello, I was wondering if there is any way to create a button macro that
will search for specific text in a column, and hide all other rows not
displaying that text, but leave rows with no data alone. For instance. If
the column i'm using is the "D" column. and the text i'm looking for is
"case". So i want to leave the rows visible that include case and rows

that
have no data in them. And a macro that will return the spread sheet back

to
normal (unhide).

Thanks for any info,

Aaron