Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
formula to check the date sequence in rows brenda Excel Discussion (Misc queries) 4 July 2nd 09 04:34 AM
automatically Add numbered rows in sequence from a given number Six Sigma Blackbelt Excel Worksheet Functions 5 September 4th 08 03:17 PM
I WANT TO ADD A TWO RANDOM CHARACTER SEQUENCE TO A SET OF ROWS XLSUSER Excel Worksheet Functions 3 November 6th 05 10:07 AM
Count rows not in sequence kamill Excel Worksheet Functions 6 May 12th 05 01:32 PM


All times are GMT +1. The time now is 02:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"