View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default VB Code to hide rows

Where the defined name range of hiderng is
=$a$1,$a$7,$a$21

or just put in sub without naming
range("a1,a7,a21").entirerow.hidden=true

Sub hidenamedrngrows()
Range("hiderng").EntireRow.Hidden = True
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lost" wrote in message
...
I want a macro that hides a dyamic named range. For example:
A
1 unhide
2 unhide
3 unhide
4 hide
5 hide
6 hide
7 unhide

The hide/unhide are based on the contents of what is in column B,
therefore
the rows that indicate hide won't be static. However the cells indicating
hide will always be next to each other (no overlap)... I was thinking that
I
need to define a named range which would include the rows that indicate
hide
in column A and then hide that named range. (ie in this case my named
range
would consist of rows 4-6, but again it wont always be this way.) I have
numerous lines of data and do NOT want the macro to have to read through
4000
cells... I figured this would be much quicker! Thanks!