Please Excel experts I ugently need some help.
This is what I tried but the Code works up to the third level only.

Sub Grouping_Test()
Dim Group_Beginn, Group_Ende
Dim a_Text, n_Text As String
Dim lastRow As Long
Dim i, L As Integer

Application.ScreenUpdating = False

Cells.ClearOutline
Range("A3").Select
lastRow = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row

For L = 1 To 6
  i = L + 2
  Do Until i + 1 > lastRow
    a_Text = Mid(Replace(Cells(i, ActiveCell.Column), ".", ""), L, 1)
    n_Text = Mid(Replace(Cells(i + 1, ActiveCell.Column), ".", ""), L, 1)
    
    If a_Text = n_Text Then
      Group_Beginn = Cells(i + 1, ActiveCell.Column).Address
      Do Until (n_Text <> a_Text) Or (i > lastRow) 
        i = i + 1
        n_Text = Mid(Replace(Cells(i, ActiveCell.Column), ".", ""), L, 1)
      Loop
      i = i - 1
      Group_Ende = Cells(i, ActiveCell.Column).Address
      If i >= lastRow Then i = lastRow
      Range(Group_Begin, Group_End).Rows.Group
    End If
     i = i + 1
  Loop
Next

Application.ScreenUpdating = True
End Sub