Sub classification()
Dim LastRow, max_level As Integer
Dim slc, j, dele, a, b As Integer
On Error Resume Next
LastRow = ActiveSheet.UsedRange.Rows.Count
For slc = 1 To LastRow
Line1:
If Sheet1.Cells(slc, "e") = "FOLDERS" Then
dele = slc + 1
For j = slc + 1 To LastRow
If Range("A" & j) > Range("A" & j + 1) Then
dele = j
Exit For
End If
Next j
Range(Rows(slc), Rows(dele)).Delete
GoTo Line1
End If
Next slc
End Sub
这里用了GOTO ,是因为删除的行,他会上移,也可以使用DO