Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Hiding everey n-th row

Hi,

I want to hide every n-th row from some point. I have a sheet with on every row a date. everey week is followed bij a total-row. I want to hide all the date viewing only he totals. However this has to start at row 9 (1-8 has a header). See the code, how can I make it start at row 9?

Sub HideRows()
Dim hRows As Long
Const myHidden As Long = 6
Const Jump1 As Long = 2
'Const Jump2 As Long = 2
Const LastRow As Long = 100
For hRows = 1 To LastRow Step Jump1 + myHidden
Rows(CStr(hRows + Jump1) & ":" & CStr(hRows + myHidden + Jump1)).Select
Selection.EntireRow.Hidden = True
'Rows(CStr(hRows + Jump1 + Jump2) & ":" & CStr(hRows + Jump1 + Jump2 + myHidden)).Select
'Selection.EntireRow.Hidden = True
Next hRows
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Hiding everey n-th row

Someone with no name,

Sub HideRows()
Dim hRows As Long
Const myHidden As Long = 6
Const Jump1 As Long = 2
Const LastRow As Long = 100

For hRows = 9 To LastRow Step Jump1 + myHidden
Rows(CStr(hRows) & ":" & CStr(hRows + myHidden)).Hidden = True
Next hRows
End Sub

Though if you have some label such as "Total" in a column, you could
simply filter your table and only show those values labeled Total....

HTH,
Bernie


wrote in message
news:1066324090.676266@cache1...
Hi,

I want to hide every n-th row from some point. I have a sheet with

on every row a date. everey week is followed bij a total-row. I want
to hide all the date viewing only he totals. However this has to start
at row 9 (1-8 has a header). See the code, how can I make it start at
row 9?

Sub HideRows()
Dim hRows As Long
Const myHidden As Long = 6
Const Jump1 As Long = 2
'Const Jump2 As Long = 2
Const LastRow As Long = 100
For hRows = 1 To LastRow Step Jump1 + myHidden
Rows(CStr(hRows + Jump1) & ":" & CStr(hRows + myHidden +

Jump1)).Select
Selection.EntireRow.Hidden = True
'Rows(CStr(hRows + Jump1 + Jump2) & ":" & CStr(hRows + Jump1 + Jump2

+ myHidden)).Select
'Selection.EntireRow.Hidden = True
Next hRows
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hiding everey n-th row

If it works now maybe the easiest is to do

Sub HideRows()
Dim hRows As Long
Const myHidden As Long = 6
Const Jump1 As Long = 2
'Const Jump2 As Long = 2
Const LastRow As Long = 100
For hRows = 1 To LastRow Step Jump1 + myHidden
if hRows 8 then
Rows(CStr(hRows + Jump1) & ":" & CStr(hRows + myHidden + Jump1)).Select
Selection.EntireRow.Hidden = True
'Rows(CStr(hRows + Jump1 + Jump2) & ":" & CStr(hRows + Jump1 + Jump2 +
myHidden)).Select
'Selection.EntireRow.Hidden = True
Next
Next hRows
End Sub

Regards,
Tom Ogilvy


wrote in message
news:1066324090.676266@cache1...
Hi,

I want to hide every n-th row from some point. I have a sheet with on

every row a date. everey week is followed bij a total-row. I want to hide
all the date viewing only he totals. However this has to start at row 9 (1-8
has a header). See the code, how can I make it start at row 9?

Sub HideRows()
Dim hRows As Long
Const myHidden As Long = 6
Const Jump1 As Long = 2
'Const Jump2 As Long = 2
Const LastRow As Long = 100
For hRows = 1 To LastRow Step Jump1 + myHidden
Rows(CStr(hRows + Jump1) & ":" & CStr(hRows + myHidden + Jump1)).Select
Selection.EntireRow.Hidden = True
'Rows(CStr(hRows + Jump1 + Jump2) & ":" & CStr(hRows + Jump1 + Jump2 +

myHidden)).Select
'Selection.EntireRow.Hidden = True
Next hRows
End Sub




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
hiding zero for a sum bb Excel Discussion (Misc queries) 3 April 20th 10 03:01 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Hiding #N/A FP Novice Excel Discussion (Misc queries) 1 August 7th 06 09:49 PM
#DIV/0! hiding GJR3599 Excel Discussion (Misc queries) 0 March 9th 05 07:54 PM
Hiding #N/A Mick Excel Worksheet Functions 4 December 1st 04 12:35 AM


All times are GMT +1. The time now is 02:47 PM.

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

About Us

"It's about Microsoft Excel"