还有就是怎么样让这些表名自已取表中某单元格内容为表名?作者: pureshadow 时间: 2008-11-3 18:27
排序没玩过
工作表名可以用代码
sub aa()
dim i as long
for i = 1 to sheets.count
sheets(i).name = sheets("某工作表").cells(i,1)
next
end sub作者: 方漠 时间: 2008-11-14 18:48
试试以下的代码,将你的工作簿插入一个新工作表:SheetNames. 然后运行此代码.
原理小妖同学已经给出, 工作表名写入列后,把此列数据排序,然后再用FOR移动工作表顺序.
Sub SortSheets()
Dim I As Integer, ii As Integer
Dim ShtName As String
On Error Resume Next
If ActiveWorkbook.Sheets.Count > 1 Then
Application.ScreenUpdating = False
With ThisWorkbook.Sheets("SheetNames")
.Columns(1).Clear
For I = 1 To ActiveWorkbook.Sheets.Count
.Cells(I, 1) = Sheets(I).Name
Next
For ii = I - 1 To 1 Step -1
ShtName = .Cells(ii, 1)
ActiveWorkbook.Sheets(ShtName).Move Before:=ActiveWorkbook.Sheets(1)
Next
End With
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
MsgBox "Worksheet sorting completed.", vbInformation
Application.ScreenUpdating = True
End If
End Sub作者: cowboy1106 时间: 2008-11-22 22:35
强人太多了~~~~~~~~~~作者: digooo 时间: 2008-11-28 23:53
同意楼上的说法