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: 65
Default Inconsistency in Macro Speed

Hi

I am experiencing some inconsistency with the speed execution of one of my
macros. Essentially I am trying to delete blank rows in the range d7:d1250.
In most cases the macro runs quickly enough, usually less than 10 seconds
however from time to time the macro will stall and it will take about 3
minutes to complete. If I press Esc the debug shows it is stuck in the
following section. If anyone can suggest why this is occuring or can provide
a better code it would be appreciated.

The code provided below is only a small part of the entire macro but I
believe this is the area causing the problem.

Thanks

Monk

Dim Rng As Range, ix As Long
Set Rng = Intersect(Range("D7:D1250"), ActiveSheet.UsedRange)
For ix = Rng.Count To 1 Step -1
If Trim(Application.WorksheetFunction.Substitute(Rng. Item(ix).Text,
Chr(160), Chr(32))) = "" Then
Rng.Item(ix).EntireRow.Delete
End If
Next
Range("D6:D1250").Select
Const StartRow As Long = 1 'Row to Start looking at
Dim StopRow As Long
Dim Col As Long
Col = ActiveCell.Column
StopRow = Cells(Rows.Count, Col).End(xlUp).Row
Dim cnt As Long
For cnt = StopRow To StartRow Step -1
If Not IsEmpty(Cells(cnt, Col)) Then
If IsNumeric(Cells(cnt, Col)) Then
If Cells(cnt, Col) = 0 Then Rows(cnt).Delete
End If
End If
Next cnt
 
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
Excel inconsistency Robert Baer Excel Discussion (Misc queries) 4 April 17th 09 06:18 PM
Logical operator inconsistency KD[_5_] Excel Programming 1 June 8th 06 10:42 AM
Tab Key Inconsistency with User Form BTuohy Excel Programming 3 April 11th 06 02:46 PM
excel macro inconsistency JM Excel Discussion (Misc queries) 2 December 9th 04 01:13 AM
excel macro inconsistency JM[_6_] Excel Programming 6 December 8th 04 09:54 PM


All times are GMT +1. The time now is 12:15 PM.

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"