View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Martin Fishlock[_4_] Martin Fishlock[_4_] is offline
external usenet poster
 
Posts: 32
Default Hiding Rows in a Range based on column A value

you can try this method:

Sub hide()
Dim r As Range
For Each r In ActiveSheet.Range("tst").Rows
If r.Cells(1, 1) = "1" Then r.Hidden = True
Next r
Set r = Nothing
End Sub


--
HTHs Martin


"tig" wrote:

I've been rummaging through the posts regarding finding the last row in
a range. They don't quite get me what I need. My ultimate goal is to
created a sub that will hide all rows with the value of "1" in column
A. Without creating a loop for the entire worksheet I want to limit
the loop to a named range, let's say "print_range". To do that I need
to be able to identify the last row of the named range. I don't think
that the Count property will give me the last row if the range doesn't
begin in row 1.

Let's say my named range is from A5:Z999.

Any ideas or insights would be greatly appreciated.

TIA