Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Grouping rows with the plus/minus icon in the first row

I found part of my answer in another post (see below) with the code:

ActiveSheet.Outline.SummaryRow = xlAbove
ActiveSheet.Range("A2", "A10").Rows.Group

But what if I wanted to Group other rows in the same worksheet in the same
fashion. For example, I would like to also apply for range A12:A20 with A11
as the row with the +/- sign. And then to A22:A30 with A21 as the row with
the +/- sign. And so on..

Also, I am fairly new to using VB, so what would be the entire set of code
to place in the in VB editor?

Thanks!!


http://www.microsoft.com/office/comm...f-6c3c230b862e


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Grouping rows with the plus/minus icon in the first row

Try the below

Sub GroupRows()
Dim lngRow As Long
For lngRow = 1 To 100 Step 10
Range("A" & lngRow + 1).Resize(9).Rows.Group
Next
ActiveSheet.Outline.SummaryRow = xlAbove
ActiveSheet.Outline.ShowLevels RowLevels:=1
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"GoBucks" wrote:

I found part of my answer in another post (see below) with the code:

ActiveSheet.Outline.SummaryRow = xlAbove
ActiveSheet.Range("A2", "A10").Rows.Group

But what if I wanted to Group other rows in the same worksheet in the same
fashion. For example, I would like to also apply for range A12:A20 with A11
as the row with the +/- sign. And then to A22:A30 with A21 as the row with
the +/- sign. And so on..

Also, I am fairly new to using VB, so what would be the entire set of code
to place in the in VB editor?

Thanks!!


http://www.microsoft.com/office/comm...f-6c3c230b862e


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Grouping rows with the plus/minus icon in the first row

Thank you Jacob! This worked! How about if one or more ranges that I wanted
Grouped were not the same amount of rows? For example if the first Group
contained 9 rows then the next Grouping contained 8, and the next 5.


"Jacob Skaria" wrote:

Try the below

Sub GroupRows()
Dim lngRow As Long
For lngRow = 1 To 100 Step 10
Range("A" & lngRow + 1).Resize(9).Rows.Group
Next
ActiveSheet.Outline.SummaryRow = xlAbove
ActiveSheet.Outline.ShowLevels RowLevels:=1
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"GoBucks" wrote:

I found part of my answer in another post (see below) with the code:

ActiveSheet.Outline.SummaryRow = xlAbove
ActiveSheet.Range("A2", "A10").Rows.Group

But what if I wanted to Group other rows in the same worksheet in the same
fashion. For example, I would like to also apply for range A12:A20 with A11
as the row with the +/- sign. And then to A22:A30 with A21 as the row with
the +/- sign. And so on..

Also, I am fairly new to using VB, so what would be the entire set of code
to place in the in VB editor?

Thanks!!


http://www.microsoft.com/office/comm...f-6c3c230b862e


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Grouping rows with the plus/minus icon in the first row

There should be some condition which cause this row count to change...For
example say you have a text called 'Total'..Find that and text and adjust the
row count to suit/

If this post helps click Yes
---------------
Jacob Skaria


"GoBucks" wrote:

Thank you Jacob! This worked! How about if one or more ranges that I wanted
Grouped were not the same amount of rows? For example if the first Group
contained 9 rows then the next Grouping contained 8, and the next 5.


"Jacob Skaria" wrote:

Try the below

Sub GroupRows()
Dim lngRow As Long
For lngRow = 1 To 100 Step 10
Range("A" & lngRow + 1).Resize(9).Rows.Group
Next
ActiveSheet.Outline.SummaryRow = xlAbove
ActiveSheet.Outline.ShowLevels RowLevels:=1
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"GoBucks" wrote:

I found part of my answer in another post (see below) with the code:

ActiveSheet.Outline.SummaryRow = xlAbove
ActiveSheet.Range("A2", "A10").Rows.Group

But what if I wanted to Group other rows in the same worksheet in the same
fashion. For example, I would like to also apply for range A12:A20 with A11
as the row with the +/- sign. And then to A22:A30 with A21 as the row with
the +/- sign. And so on..

Also, I am fairly new to using VB, so what would be the entire set of code
to place in the in VB editor?

Thanks!!


http://www.microsoft.com/office/comm...f-6c3c230b862e


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
How to get the plus/minus at the top when grouping beac Excel Worksheet Functions 4 April 19th 23 02:14 PM
Grouping rows in Excel with the plus/minus icon in the first row MattMatthias Excel Programming 3 June 24th 09 09:15 AM
How to select Visible Cells range minus 2 rows (frozen panes) LuisE Excel Programming 5 November 22nd 07 05:01 AM
CHANGE TRAILING MINUS TO BRACKETS OR PRECEEDING MINUS Socal Analyst looking for help Excel Discussion (Misc queries) 2 May 12th 06 07:17 PM
sum and minus columns and rows at the same time MARY Charts and Charting in Excel 0 February 7th 06 08:43 PM


All times are GMT +1. The time now is 05:29 AM.

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"