G
Guest
I can't figure out why this code takes 9 seconds to run. What it does is
switch the contents of two adjacent cells. It does have to unprotect the
worksheet and also turn off autocalculation, then restore both of those
settings. But the core code doesn't do much that should generate the delay I
am seeing. Any ideas from the experts? TIA
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveSheet.Unprotect Password:="password"
Selection.Cut
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.Insert Shift:=xlToRight
ActiveSheet.Protect Password:="password", DrawingObjects:=True,
Contents:=True, Scenarios:=True _
, AllowFiltering:=True
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
switch the contents of two adjacent cells. It does have to unprotect the
worksheet and also turn off autocalculation, then restore both of those
settings. But the core code doesn't do much that should generate the delay I
am seeing. Any ideas from the experts? TIA
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveSheet.Unprotect Password:="password"
Selection.Cut
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.Insert Shift:=xlToRight
ActiveSheet.Protect Password:="password", DrawingObjects:=True,
Contents:=True, Scenarios:=True _
, AllowFiltering:=True
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False