Remove empty Outline group

Copper Contributor

Hello, 

somehow I created accidently an Outline group which is empty in Excel Version 2302 Microsoft 365 Apps for Enterprise.

These groups seem to be empty but I am not sure how to remove them without removing the other groups.
How can I remove group 4 + 5 which do not seem to have any meaning ? See picture below.

 

Bet regards

Frank

 image.png

 

__PRESENT

__PRESENT

3 Replies

Hi @FrankK2185,


There are two ways to remove empty outline groups in Excel Version 2302 Microsoft 365 Apps for Enterprise:

1. Using the Outline Group window

  1. Select any cell in the outline.
  2. Click the Data tab.
  3. In the Outline group, click Show Outline to open the Outline Group window.
  4. Select the outline group that you want to remove.
  5. Click the Delete button.
  6. Click Yes to confirm.

2. Using the VBA Macro

 

  1. Open the Visual Basic Editor (press Alt+F11).
  2. Insert a new module (press Insert > Module).
  3. Paste the following code into the module:
 

 

 

Sub RemoveEmptyOutlineGroups()

'Declare variables
Dim wks As Worksheet
Dim outlineGroup As OutlineGroup

'Set the worksheet variable
Set wks = ActiveSheet

'Iterate through all outline groups on the worksheet
For Each outlineGroup In wks.OutlineGroups

'If the outline group is empty, delete it
If outlineGroup.Count = 0 Then outlineGroup.Delete

Next outlineGroup

End Sub

 

 

 
  1. Save the module and close the Visual Basic Editor.
  2. To run the macro, press Alt+F8 to open the Macro dialog box.
  3. Select the RemoveEmptyOutlineGroups macro and click Run.


Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)

@LeonPavesic 

Hello thanks for your answer.

Actually I do not have button Show Outline

FrankK2185_0-1695996884131.png

Running the VBA macro throws an error:

FrankK2185_1-1695996947209.png

 

Best regards

Frank

 

__PRESENT

Hello.
If there is no Show Outline item,
After clicking on the Data tab, right-click elsewhere and bring up the ribbon user settings.
From there, you can click "Outline" to display it.
After that, I think you can select the cell of the part from again and go from the "Outline" item. (It was displayed in my environment)