Dim levalmax as integer
Sub auto_level_exit ()
Oldrow = 0
Linmax = sheet1.usedrange. Rows. Count
Colonmax = sheet1.usedrange. Columns. Count
'Msgbox "auto_level_exit oldrow is:" & oldrow
I = 100.
Levalmax = 1
For I = linmax to 1 step-1
Str1 = sheet1.cells (I, 1)
Str2 = right (str1, 5)
If str2 = "exit" or str2 = "exit" then
Oldrow = newrow
Newrow = I
For J = I-1 to 1 step-1
Str3 = sheet1.cells (J, 1)
Str4 = left (str3, Len (str1)-1)
Str5 = right (str4, 4)
If str5 <> "" then
Oldrow = J + 1
J = 0
If oldrow <> newrow then
Rows (oldrow & ":" & newrow). Select
Selection. Rows. Group
Exit
End if
End if
Next
'Get number of space to calculate the level
Spacelen = Len (str1)
Levelnum = spacelen/4
If levalmax <levelnum then
Levalmax = levelnum
End if
End if
Next
End sub
Sub auto_level_echo ()
Oldrow = 0
Linmax = sheet1.usedrange. Rows. Count
Colonmax = sheet1.usedrange. Columns. Count
'Msgbox "oldrow is:" & oldrow
For I = 1 to linmax
Str1 = sheet1.cells (I, 1)
Str2 = left (str1, 6)
If str2 = "Echo" then
Oldrow = newrow
Newrow = I
If oldrow <> 0 then
Rows (oldrow + 1 & ":" & newrow-2). Select
Selection. Rows. Group
End if
End if
If I = linmax-7 then
Rows (newrow + 1 & ":" & I). Select
Selection. Rows. Group
End if
Next
End sub
Sub auto_nolevel_echo ()
Oldrow = 0
Linmax = sheet1.usedrange. Rows. Count
Colonmax = sheet1.usedrange. Columns. Count
'Msgbox "oldrow is:" & oldrow
'Rowlevel = sheet1.outline. summaryrow
'Colormnlevel = sheet1.outline. summarycolumn
For I = 1 to levalmax-1 'linmax
Rows (1 & ":" & linmax). Select
Selection. Rows. ungroup
Next
Levalmax = 0
End sub
Sub auto_level_config ()
Dim I, j as integer
Dim str1, str2, str3 as string
Dim linemax, colonmax as integer
Linmax = sheet1.usedrange. Rows. Count
Colonmax = sheet1.usedrange. Columns. Count
'Msgbox "line is:" & linmax & "column is" & colonmax
Oldrow = 1
Newrow = 5
Auto_level_echo
Auto_level_exit
End sub
Sub nogroup ()
'
'Nogroup macro
'
Rows ("1742: 1747"). Select
Selection. Copy
Application. cutcopymode = false
Selection. Rows. ungroup
End sub
Auto Group the config file