当某些行或列被分组时,用户将能够看到+(加号)符号以展开组合在一起的所有行或列。展开所有行或列后,用户将能够看到 - (减号)符号以折叠它们。现在什么是嵌套分组?嵌套意味着嵌套分组是在组内进行分组。
现在我使用鼠标指针捕获,但它不捕获嵌套组
Public Declare PtrSafe Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Public z As POINTAPI
Private Sub Worksheet_Calculate()
Dim lRow As Long
Application.EnableEvents = False
'get mouse pinter
GetCursorPos z
'check if mouse pressed
If ActiveWindow.RangeFromPoint(z.x, z.y) Is Nothing Then
'found row near pointer
On Error Resume Next
lRow = ActiveWindow.RangeFromPoint(z.x + 300, z.y).Row
' check if this row hidden
If Rows(lRow + 1).Hidden = False Then
MsgBox ("Opened " & Rows(lRow + 1).OutlineLevel)
Else
MsgBox ("Hidened " & Rows(lRow + 1).OutlineLevel)
End If
End If
Application.EnableEvents = True
End Sub
如何捕获其中一个(行级别或列级别)(+, - 或1,2,3,4,5,6,7,8(嵌套组))按钮
因为我只能
Sub Expand_All()
ActiveSheet.Outline.ShowLevels RowLevels:=8, ColumnLevels:=8
End Sub
和
Sub Collapse_All()
ActiveSheet.Outline.ShowLevels RowLevels:=1, ColumnLevels:=1
End Sub
和
检查隐藏的行,但我需要按下按钮的检查状态,以便从功能区控制它。
之类的东西Sub Outline_Click() '(+ or - or one of 1,2,3,4,5,6,7,8)
msgbox "pressed " & Application.Caller
end Sub