Function AutoClassify() '自动分级
Dim j As Integer
Dim i As Long
Dim rowNumber As Variant
ActiveSheet.UsedRange.ClearOutline
Dim LastLevel, level, col As Integer
rowNumber = ActiveSheet.UsedRange.Rows.Count
For i = 3 To rowNumber '从第3行开始组合.根据传入行数分级组合
If Cells(i, 1) = "" Then '通过第一行为空认为是function,组合
Rows(i).Group
End If
Next i
'最后只显示第一级
ActiveSheet.Outline.ShowLevels RowLevels:=1
'分级加号放在上面
With ActiveSheet.Outline
.SummaryRow = xlAbove
End With
End Function
Dim j As Integer
Dim i As Long
Dim rowNumber As Variant
ActiveSheet.UsedRange.ClearOutline
Dim LastLevel, level, col As Integer
rowNumber = ActiveSheet.UsedRange.Rows.Count
For i = 3 To rowNumber '从第3行开始组合.根据传入行数分级组合
If Cells(i, 1) = "" Then '通过第一行为空认为是function,组合
Rows(i).Group
End If
Next i
'最后只显示第一级
ActiveSheet.Outline.ShowLevels RowLevels:=1
'分级加号放在上面
With ActiveSheet.Outline
.SummaryRow = xlAbove
End With
End Function