|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 11()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Range("A2:V5000").Select
Selection.ClearContents
Dim MyDir$, MyPath$, ar
MyDir = Dir(ThisWorkbook.Path & "/*.xls")
MyPath = ThisWorkbook.Path & "/"
While MyDir <> ""
If InStr(MyDir, ThisWorkbook.Name) Then MyDir = Dir
If MyDir = "" Then End
With Workbooks.Open(MyPath & MyDir)
a = .ActiveSheet.Cells(3, 8)
b = .ActiveSheet.Cells(2, 12)
c = .ActiveSheet.Cells(2, 8)
ActiveSheet.Range("O7") = "=MATCH(""合计"",C[-14],0)"
d = ActiveSheet.Range("O7") - 6
ar = .ActiveSheet.Range("a" & 6 & ":" & "m" & d + 5)
e = ActiveWorkbook.Name
Application.DisplayAlerts = 0
.Close
End With
x = Sheet1.Range("A65536").End(xlUp).Row
For i = 1 To d
Sheet1.Cells(x + i, 1) = a
Sheet1.Cells(x + i, 2) = b
Sheet1.Cells(x + i, 3) = c
Sheet1.Cells(x + i, 4) = e
Sheet1.Cells(x + i, 5) = "=MID(RC[-1],1,5)"
Next
Sheet1.Range(Cells(x + 1, 6), Cells(x + d, 18)) = ar
MyDir = Dir
Wend
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Application.Calculation = xlCalculationAutomatic请问各位大侠,这个语句怎么恢复不了自动重算的?我把红色部分删除,执行就可以恢复自动重算,哪位能帮我解释一下?
|
|