Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide a sequence of rows
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide a sequence of rows
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide a sequence of rows
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Enabling option „Format rows“ to hide/unhide rows using VBA-code? | Excel Discussion (Misc queries) | |||
formula to check the date sequence in rows | Excel Discussion (Misc queries) | |||
automatically Add numbered rows in sequence from a given number | Excel Worksheet Functions | |||
I WANT TO ADD A TWO RANDOM CHARACTER SEQUENCE TO A SET OF ROWS | Excel Worksheet Functions | |||
Count rows not in sequence | Excel Worksheet Functions |