|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
feng1989 发表于 2014-2-27 11:39
是按序号自动分级!
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
arr = Sheets(1).UsedRange
l1 = 2
For j = 2 To UBound(arr)
If Len(arr(j, 1)) > 0 Then
r = Sheets(UBound(Split(arr(j, 1), ".")) + 2).Cells.Find("*", , , , 1, 2).Row
Sheets(1).Range("a" & j & ":p" & j).Copy Sheets(UBound(Split(arr(j, 1), ".")) + 2).Cells(r, 1).Offset(1, 0)
l1 = j
Else
r = Sheets(UBound(Split(arr(l1, 1), ".")) + 2).Cells.Find("*", , , , 1, 2).Row
Sheets(1).Range("a" & j & ":p" & j).Copy Sheets(UBound(Split(arr(l1, 1), ".")) + 2).Cells(r, 1).Offset(1, 0)
End If
Next j
Application.ScreenUpdating = True
End Sub |
|