imtryinhard
New Member
- Joined
- Nov 14, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
I am trying to write a personal macro script to Expand (Show Detail) or Collapse (Hide detail) of a very large (300R x 200C worksheet) that i frequently toggle between a summary view and full model view so i don't have to keep using my mouse click on the little 1-2-3 groups in the upper left with my mouse.
I want to have it so that if the outline is expanded (=2) then collapse it, adn if it's already collapsed, expand it.
But this code isn't working
Help would be appreciated...thanks!
I want to have it so that if the outline is expanded (=2) then collapse it, adn if it's already collapsed, expand it.
But this code isn't working
VBA Code:
Sub CollapseExpando()
If ActiveSheet.ShowLevels.rowlevels = 2 Then
ActiveSheet.Outline.ShowLevels rowlevels:=1
Else if ActiveSheet.ShowLevels.rowlevels = 1 Then
ActiveSheet.Outline.ShowLevels rowlevels:=2
End If
End Sub
Help would be appreciated...thanks!
Last edited by a moderator: