2016-09-27 39 views
1

在Excel VBA中,我可以在工作表組行使用Excel的VBA確定

NewSheet.rows("15:22").Group 

分組工作表行,但我怎麼能確定哪些行是在工作表已經分組?

+0

檢查行的'OutlineLevel',也許? –

回答

1

使用下面的代碼掃描「NewSheet」中的數據的所有行,並檢查每行是否已分組。

' scan all rows in your sheet 
For i = 2 To lastRow 

    ' check isf current row is grouped 
    If NewSheet.Rows(i).OutlineLevel > 1 Then 
     ' do something 

    End If 
Next i