展平轮廓数据然后再次重建轮廓

问题描述

给我的同龄人,

基本上,我从生成概述报告的业务系统中提取了 BOM(没有模板只是将数据推送到 Excel 表中)。其示例如下所示:

enter image description here

我需要展平此提取物以执行一些操作,无论如何使用显示的列我可以重新将大纲分组重建为原来的样子吗?

谢谢

解决方法

Public Sub SetOutline()

  Dim i As Long

  With [A:A].Cells                        'column containing levels
    For i = 1 To .Count
      If IsEmpty(.Item(i)) Then Exit For  'quit at first blank cell
      .Item(i).EntireRow.OutlineLevel = .Item(i).Value + 1 'set outline
'      .Item(i).EntireRow.ClearOutline    'this would remove the outline
    Next i
  End With

End Sub