Excel怎样快速批量将相同表式多文件数据修改
Option Explicit
Sub test() '新建工作簿,与文件夹一起放在同一目录下
Dim p$, fd, f$, sh As Worksheet
Application.ScreenUpdating = False
For Each fd In CreateObject("Scripting.FileSystemObject").GetFolder(ThisWorkbook.Path).SubFolders
p = fd & "\"
f = Dir(p & "*.xls*")
Do While f <> ""
If f <> ThisWorkbook.Name Then
With Workbooks.Open(p & f, 0)
For Each sh In .Worksheets
sh.Cells.Replace "正常", "1", xlWhole
sh.Cells.Replace "异常", "2", xlWhole
Next
.Close 1
End With
End If
f = Dir
Loop
Next
Application.ScreenUpdating = True
End Sub