View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jen[_4_] Jen[_4_] is offline
external usenet poster
 
Posts: 47
Default Rows Group -looping issue

Thanks Tom,

What I hoped it would do & didn't manage myself!
:-)

"Tom Ogilvy" wrote in message
...
Sub ABCDE()
set rng = ActiveSheet.UsedRange()
For i = 16 To rng(rng.count).row Step 10
Rows(i).Resize(5).Group
Next
ActiveSheet.Outline.ShowLevels RowLevels:=2
End Sub

--
Regards,
Tom Ogilvy

"Jen" wrote:

Hi There,

I wish to group of couple of lines at "regular" intervals .... but i fail
to
get the "looping" right.
((It seems I cannot just put the "integer"-counter in the
Rows("...")-part
of Rows("16:20").Rows.Group))


Anyway the original code I recorded -i removed the select-part- was as
follows:

Sub Macro5()

Rows("16:20").Rows.Group
Rows("26:30").Rows.Group
Rows("36:40").Rows.Group
'....untill end of used range
With ActiveSheet.Outline
.AutomaticStyles = False
.SummaryRow = xlAbove
.SummaryColumn = xlRight
End With
End Sub

What I wish to achieve is that:
Starting from Row10 I group 5 rows up, from 10 rows below Row10,ie Row20
and so on till the endrow in my usedrange.

I hope this makes sense ... ?
Hope you can help me,
Jen