|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub Zldccmx()
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim Shname
For Each sh In ThisWorkbook.Worksheets
If sh.Name <> "目录" Then Shname = Shname & "," & sh.Name
Next
Shname = Split(Mid(Shname, 2), ",")
With Sheets("目录")
.Cells(1, 255).Resize(UBound(Shname) + 1, 1) = WorksheetFunction.Transpose(Shname)
.Columns("IU:IU").Sort Key1:=.Range("IU1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin, DataOption1:=xlSortTextAsNumbers
.Cells(1, 256).Resize(UBound(Shname) + 1, 1) = "=row()+1"
Shname = .Range([iu1], [iv1].End(xlDown))
.Range([iu1], [iv1].End(xlDown)) = ""
End With
For i = 1 To UBound(Shname)
Sheets(Shname(i, 1)).Move before:=Sheets(Shname(i, 2))
Next
Application.EnableEvents = True
End Sub |
|