0
我希望有人也许能够帮助让我在这里...折叠某些群体(不是全部)使用VBA
我有一个巨大的名单,并正在使用分组来组织它:
正如您所看到的,我有一个主要组行,其中包含许多产品。然后,有些产品会在该部分下面分组。
我想要的是折叠只显示产品的所有配件组。下面的代码将展开未扩展的组,我不希望这样。
shtOTP.Outline.ShowLevels RowLevels:=4
shtOTP.Outline.ShowLevels RowLevels:=3
shtOTP.Outline.ShowLevels RowLevels:=2
ActiveWindow.ScrollRow = shtOTP.Range("A3").row 'Go to top of sheet
我试图寻找到.Outline.Parent
.Outline.SummaryRow
功能,但据我可以告诉他们不识别该组的“父”。
我可以做一个循环以下:
For i = 3 To getLastRow
Dim nextRow As Integer
nextRow = shtOTP.Rows(i+1).row
If nextRow = ParentRow And i.EntireRow.Hidden = False Then
'Collapse the group below the product
End If
Next
但是......
如何做我确定如果nextRow是parentRow?
如何我是否应该折叠?