所有的Sheet 都叫一个名字 是不可能的,因为Sheet名称不允许重复,
批量改名是可以实现的, 不过你也没说清楚要怎么改
需要的话,写清楚要求,发2 样本至 1052974911@qq.com
Sub Test()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim pth As String, wb As Workbook, nwb As Workbook
Dim Dic, Did, I, MyFileName
Dim brr(), n As Integer, m As Integer
Set Dic = CreateObject("Scripting.Dictionary")
Set wb = ThisWorkbook
pth = ThisWorkbook.Path
Dic.Add (wb.FullName), ""
MyPath = ThisWorkbook.Path & "\*.xls*"
MyFileName = Dir(MyPath)
Dic(ThisWorkbook.Path & "\" & MyFileName) = ""
Do
MyFileName = Dir
If MyFileName = "" Then Exit Do
Dic(ThisWorkbook.Path & "\" & MyFileName) = ""
Loop
For Each ke In Dic.keys
If ke <> wb.FullName Then
Set nwb = Workbooks.Open(ke)
Else
Set nwb = wb
End If
With nwb
for i=1 to .worksheets.count
.worksheets(i).name="Sheet" & i
next
End With
If ke <> wb.FullName Then
nwb.Close True
Else
nwb.Save
End If
Set nwb = Nothing
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
随便打开一个excel,alt+F11,插入,模块,粘贴代码,运行
只修改同目录下的Excel文件,按顺序命名为sheet1,sheet2……