View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Hide a sequence of rows

gocush,

The single quote simply prevents Excel from trying to interpret the row
addresses as a time, and ensures that it is entered as text. I could have
used another line to format the storage cell as text, but that's extra code
that is unnecessary....

HTH,
Bernie
MS Excel MVP

"gocush" wrote in message
...
Bernie can you tell me more about the single quote
in the line:
----------------------------------
myRec.Value = "'27:51"
---------------------------------
Thanks

"Bernie Deitrick" wrote:

Dominique,

You can do it by keeping a record of what needs to be hidden in another
cell. For example, if Z1 is currently blank, try the macro below. Of
course, you can change the Z1 to any cell you want.

HTH,
Bernie
MS Excel MVP

Sub DomHideRows()
Dim myRec As Range

Set myRec = Range("Z1")

If myRec.Value = "" Then
myRec.Value = "'27:51"
Range("2:26").EntireRow.Hidden = True
Else
Range(myRec.Value).EntireRow.Hidden = True
myRec.Value = "'" & Range(myRec.Value).Offset(25).Address
End If

End Sub



"Dominique Feteau" wrote in message
...
I would like to hide a sequence of rows. I would run the macro and

rows
2-26 would be hidden. I would like to run the macro again a week

later
and
hide the next 25 rows.

How do i do that?

dominique