![]() |
How can I find out the Maximum Outline Rowlevel?
Hi!
My problem is the following: I can display certain Rowlevels by using this command: ActiveSheet.Outline.ShowLevels RowLevels:=2 But I want to find out how many rowlevels there are. Does anybody have any clue about this? Thank you in advance! Wassi -- Message posted from http://www.ExcelForum.com |
How can I find out the Maximum Outline Rowlevel?
You're looking for the highest level or the highest level visible?
This just checks visible cells: Option Explicit Sub testme99() Dim myRange As Range Dim myCell As Range Dim maxLevel As Long With ActiveSheet Set myRange = Intersect(.Columns(1), .UsedRange) _ .SpecialCells(xlCellTypeVisible) maxLevel = 0 For Each myCell In myRange.Cells If myCell.EntireRow.OutlineLevel maxLevel Then maxLevel = myCell.EntireRow.OutlineLevel End If Next myCell End With MsgBox "Largest visible level: " & maxLevel End Sub If you want all the cells, then this: Set myRange = Intersect(.Columns(1), .UsedRange) _ .SpecialCells(xlCellTypeVisible) becomes Set myRange = Intersect(.Columns(1), .UsedRange) "Wassim <" wrote: Hi! My problem is the following: I can display certain Rowlevels by using this command: ActiveSheet.Outline.ShowLevels RowLevels:=2 But I want to find out how many rowlevels there are. Does anybody have any clue about this? Thank you in advance! Wassim --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
All times are GMT +1. The time now is 03:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com