如下Excel宏代码,将工作表按首字母倒序排的(.....DCBA),怎样修改为正序(ABCD......)
Sub工作表标签排序()n=Sheets.CountFori=1TonCells(i,Columns.Count).NumberFormatLocal="@"Cells(...
Sub 工作表标签排序()
n = Sheets.Count
For i = 1 To n
Cells(i, Columns.Count).NumberFormatLocal = "@"
Cells(i, Columns.Count) = Sheets(i).Name
Next
Cells(1, Columns.Count).Resize(n).Sort Cells(1, Columns.Count)
R = Cells(1, Columns.Count).Resize(n)
Cells(1, Columns.Count).Resize(n) = ""
For i = 1 To n
Sheets(R(i, 1)).Move Sheets(1)
Next
End Sub 展开
n = Sheets.Count
For i = 1 To n
Cells(i, Columns.Count).NumberFormatLocal = "@"
Cells(i, Columns.Count) = Sheets(i).Name
Next
Cells(1, Columns.Count).Resize(n).Sort Cells(1, Columns.Count)
R = Cells(1, Columns.Count).Resize(n)
Cells(1, Columns.Count).Resize(n) = ""
For i = 1 To n
Sheets(R(i, 1)).Move Sheets(1)
Next
End Sub 展开
1个回答
展开全部
Sub 工作表标签排序()
n = Sheets.Count
For i = 1 To n
Cells(i, Columns.Count).NumberFormatLocal = "@"
Cells(i, Columns.Count) = Sheets(i).Name
Next
Cells(1, Columns.Count).Resize(n).Sort Cells(1, Columns.Count)
R = Cells(1, Columns.Count).Resize(n)
Cells(1, Columns.Count).Resize(n) = ""
For i = n To 1 Step -1 '修改了这句
Sheets(R(i, 1)).Move Sheets(1)
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询