|
Sub 批量修改()
Application.ScreenUpdating = False
lj = ThisWorkbook.Path & "\"
f = Dir(lj & "*.txt")
Do While f <> ""
Workbooks.OpenText Filename:=lj & f
With ActiveWorkbook.Worksheets(1)
r = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To r
If .Cells(i, 1) <> "" Then
rr = Split(.Cells(i, 1), " ")
zd = rr(1)
zf = Left(rr(1), 2) & ":" & Right(rr(1), 2)
.Cells(i, 1) = Replace(.Cells(i, 1), zd, zf)
End If
Next i
End With
ActiveWorkbook.Close True
f = Dir
Loop
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|