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