Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Speed of Execution

I have noticed that when my code comes to things like this:
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
that it slows WAY DOWN! At the start of the subs I have this:
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Cursor = xlWait
but it still is very slow. I am in a new workbook that I just added during
the execution. Would I need to execute the enableevents statement on the
newly added wb too or is the statement at time of beginning the calling sub
sufficient? Any ideas?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Speed of Execution

Try also to toggle
Application .Calculation = xlManual

Application .Calculation = xlAutomatic

Regards,
Stefi

€˛Mike H.€¯ ezt Ć*rta:

I have noticed that when my code comes to things like this:
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
that it slows WAY DOWN! At the start of the subs I have this:
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Cursor = xlWait
but it still is very slow. I am in a new workbook that I just added during
the execution. Would I need to execute the enableevents statement on the
newly added wb too or is the statement at time of beginning the calling sub
sufficient? Any ideas?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Speed of Execution

All those changes to the selected cells are to formats. None of them trigger
an event or trigger calculation. So, unless your code is changing the
selection, disabling those application settings is unlikely to help, if
anything counter-productive. Same applies to calculation, don't change it
simply for this.

If the selection is extremely large re-formatting all those properties might
take a while, and probably unnecessary.

However, if you are changing the selection in some kind of loop, post the
code.

Regards,
Peter T

"Mike H." wrote in message
...
I have noticed that when my code comes to things like this:
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
that it slows WAY DOWN! At the start of the subs I have this:
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Cursor = xlWait
but it still is very slow. I am in a new workbook that I just added

during
the execution. Would I need to execute the enableevents statement on the
newly added wb too or is the statement at time of beginning the calling

sub
sufficient? Any ideas?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Speed of Execution

Hello,

I agree with Peter on this one, it looks like recorded code.

1- What are you trying to do with this code? Center some text? If so,
you can delete most of these instructions to make the code compact/
faster.
2- What selection are you acting on? Are you limiting the selection to
only the text you need to manipulate?


Hope this helps,
JP

On Oct 5, 5:11 am, Mike H. wrote:
I have noticed that when my code comes to things like this:
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
that it slows WAY DOWN! At the start of the subs I have this:
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Cursor = xlWait
but it still is very slow. I am in a new workbook that I just added during
the execution. Would I need to execute the enableevents statement on the
newly added wb too or is the statement at time of beginning the calling sub
sufficient? Any ideas?


Reply
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
Speed up Excel execution Sinus Log Excel Programming 5 December 8th 05 05:03 AM
code execution speed question Gary Keramidas Excel Programming 1 October 24th 05 09:05 PM
Execution speed for UDF Christian[_5_] Excel Programming 0 September 28th 04 04:20 PM
Extremely Slow VBA Execution Speed Joe Adams[_3_] Excel Programming 3 May 15th 04 01:23 AM
MACRO execution speed ericd Excel Programming 3 March 2nd 04 03:06 PM


All times are GMT +1. The time now is 07:45 PM.

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

About Us

"It's about Microsoft Excel"