LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default very slow code

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow code when used as VBA code instead of macro (copying visible columns) [email protected] Excel Programming 3 April 2nd 07 05:26 PM
slow code NickHK Excel Programming 0 December 21st 06 02:32 AM
Can someone help me with this slow code BillReese Excel Programming 7 September 3rd 05 12:34 AM
Slow Code Shawn Excel Programming 7 August 23rd 05 08:44 PM
Is this slow code? Tom Excel Programming 4 March 3rd 04 11:18 PM


All times are GMT +1. The time now is 04:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"