Last active
April 28, 2018 13:54
-
-
Save ndthanh/fc103355a0fb6ce37a78b3542c5951f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub withoutCalculationSettings() | |
Dim i As Long, t As Single | |
t = Timer | |
With Sheet1 | |
For i = 1 To 1000 | |
.Range(.Range("A" & i), .Range("E" & i)).Formula = _ | |
"=randbetween(1,1000)" | |
Next | |
End With | |
MsgBox "Done " & (Timer - t) | |
End Sub | |
Sub withCalculationSettings() | |
Dim i As Long, t As Single | |
t = Timer | |
With Sheet1 | |
Application.Calculation = xlCalculationManual | |
For i = 1 To 1000 | |
.Range(.Range("A" & i), .Range("E" & i)).Formula = _ | |
"=randbetween(1,1000)" | |
Next | |
Application.Calculation = xlCalculationAutomatic | |
End With | |
MsgBox "Done " & (Timer - t) | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment