Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to Outline based on Indent Level

I have a worksheet with column B being titles that are indented to
outline the list (I even have the indent level a column). I would
like to outline this with VBA with a macro, so I can hide and show the
details as necessary. Can anyone help me with how to set up the loops
to search and determine the first and last rows of the group. My
summary row is above.

I know how to group and outline rows manually and have recorded it.
The issue is I want to be able to automate the process for future
versions. I also add and delete rows which causes outlining errors.

Example
Row Description indent LevelMore columns
1 Desc 1 0
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 2
1 Desc 1 0
1 Desc 1 1
1 Desc 1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to Outline based on Indent Level

Hope this helps. You can remove idents by use negaive numbers for
identlevel. You will get an error 1004 if you go under 1. If the ident
level is two you can one use identlevel -1 (-2 will give the error).

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/13/2007 by Joel Warburg
'

'Ident text
For RowCount = 1 To 10

Range("A" & CStr(RowCount)).InsertIndent RowCount

Next RowCount

'read ident level
For RowCount = 1 To 10

MsgBox (CStr(Range("A" & CStr(RowCount)).IndentLevel))

Next RowCount

End Sub


" wrote:

I have a worksheet with column B being titles that are indented to
outline the list (I even have the indent level a column). I would
like to outline this with VBA with a macro, so I can hide and show the
details as necessary. Can anyone help me with how to set up the loops
to search and determine the first and last rows of the group. My
summary row is above.

I know how to group and outline rows manually and have recorded it.
The issue is I want to be able to automate the process for future
versions. I also add and delete rows which causes outlining errors.

Example
Row Description indent LevelMore columns
1 Desc 1 0
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 2
1 Desc 1 0
1 Desc 1 1
1 Desc 1


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to Outline based on Indent Level

Joel,

Sorry for the confusion. the example below is what I already have. I
want to be able to use the "Outline" ability of Excel to hide an show
the subordanate rows. To the left of the row numbers there are + & -
the show groups of rows. I want to group them with VBA. I want to
keep the indenting.

Example of current sheet. I want to group the 2's below the 1s and
the 1s below the 0. I actually have 4 levels of indents. I have
about 300 rows therefore speed is a concern.
Row Description indent LevelMore columns
1 Desc 0
2 Desc 1
3 Desc 2
4 Desc 2
5 Desc 1
6 Desc 2
7 Desc 2
8 Desc 2
9 Desc 0
10 Desc 1
11 Desc 1


On Apr 13, 11:54 am, Joel wrote:
Hope this helps. You can remove idents by use negaive numbers for
identlevel. You will get an error 1004 if you go under 1. If the ident
level is two you can one use identlevel -1 (-2 will give the error).

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/13/2007 by Joel Warburg
'

'Ident text
For RowCount = 1 To 10

Range("A" & CStr(RowCount)).InsertIndent RowCount

Next RowCount

'read ident level
For RowCount = 1 To 10

MsgBox (CStr(Range("A" & CStr(RowCount)).IndentLevel))

Next RowCount

End Sub

" wrote:
I have a worksheet with column B being titles that are indented to
outline the list (I even have the indent level a column). I would
like to outline this with VBA with a macro, so I can hide and show the
details as necessary. Can anyone help me with how to set up the loops
to search and determine the first and last rows of the group. My
summary row is above.


I know how to group and outline rows manually and have recorded it.
The issue is I want to be able to automate the process for future
versions. I also add and delete rows which causes outlining errors.


Example
Row Description indent LevelMore columns
1 Desc 1 0
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 2
1 Desc 1 0
1 Desc 1 1
1 Desc


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to Outline based on Indent Level

I provided the code you asked for so in the future you can automatically add
the identing. You basically want to either
1) hide every row with an ident of 2 or more.
2) Or unhide all rows.


"Carlg" wrote:

Joel,

Sorry for the confusion. the example below is what I already have. I
want to be able to use the "Outline" ability of Excel to hide an show
the subordanate rows. To the left of the row numbers there are + & -
the show groups of rows. I want to group them with VBA. I want to
keep the indenting.

Example of current sheet. I want to group the 2's below the 1s and
the 1s below the 0. I actually have 4 levels of indents. I have
about 300 rows therefore speed is a concern.
Row Description indent LevelMore columns
1 Desc 0
2 Desc 1
3 Desc 2
4 Desc 2
5 Desc 1
6 Desc 2
7 Desc 2
8 Desc 2
9 Desc 0
10 Desc 1
11 Desc 1


On Apr 13, 11:54 am, Joel wrote:
Hope this helps. You can remove idents by use negaive numbers for
identlevel. You will get an error 1004 if you go under 1. If the ident
level is two you can one use identlevel -1 (-2 will give the error).

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/13/2007 by Joel Warburg
'

'Ident text
For RowCount = 1 To 10

Range("A" & CStr(RowCount)).InsertIndent RowCount

Next RowCount

'read ident level
For RowCount = 1 To 10

MsgBox (CStr(Range("A" & CStr(RowCount)).IndentLevel))

Next RowCount

End Sub

" wrote:
I have a worksheet with column B being titles that are indented to
outline the list (I even have the indent level a column). I would
like to outline this with VBA with a macro, so I can hide and show the
details as necessary. Can anyone help me with how to set up the loops
to search and determine the first and last rows of the group. My
summary row is above.


I know how to group and outline rows manually and have recorded it.
The issue is I want to be able to automate the process for future
versions. I also add and delete rows which causes outlining errors.


Example
Row Description indent LevelMore columns
1 Desc 1 0
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 1
1 Desc 1 2
1 Desc 1 2
1 Desc 1 2
1 Desc 1 0
1 Desc 1 1
1 Desc



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 promote/demote Excel rows to new outline group level? GY2 Excel Discussion (Misc queries) 0 February 17th 10 02:55 PM
Resetting view when hiding detail in outline level VJP Excel Discussion (Misc queries) 0 November 9th 07 02:29 PM
Test for outline level of cell fgrose Excel Worksheet Functions 3 July 16th 07 10:52 PM
In a formula how can I reference the outline level of a row? Dana DeLuca Excel Worksheet Functions 1 May 9th 07 09:26 PM
How can I query the 'indent' level of text in a cell? NJDevil Excel Programming 10 October 12th 05 04:46 PM


All times are GMT +1. The time now is 06:12 PM.

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"