LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Macro speed decreesing after each run

Dear Scott, below sub might give you some idea how helper columns can
be used deleting unwanted rows.
Sheet pickuptime2 has 20.000 plus rows and the code works with
lighting speed..
Simply put the sub deletes some of data when they get older than 30
days.

Sub cleantours()

Dim rngA As Range
Dim rngB As Range
Dim rngC As Range

Dim strA As String
Dim strB As String
Dim strC As String

Call sortpickuptime2

Set rngA = Application.Intersect(Worksheets("pickuptime2") _
.Range("h2:h65526"), Worksheets("pickuptime2").UsedRange.EntireRow)
Set rngB = Application.Intersect(Worksheets("pickuptime2") _
.Range("I2:I65526"), Worksheets("pickuptime2").UsedRange.EntireRow)
Set rngC = Application.Intersect(Worksheets("pickuptime2") _
.Range("j2:j65526"), Worksheets("pickuptime2").UsedRange.EntireRow)

strA = "=IF(G2="""","""",ISNUMBER(MATCH(G2,sale!$V$2:$V$5 0000,0)))"
strB = "=IF(B2="""","""",(B2<TODAY()))"
strC =
"=IF(A2="""","""",IF(B2+30<TODAY(),"""",IF(AND(H2= FALSE,I2=TRUE),"""",""a"")))"

rngA.Formula = strA
rngB.Formula = strB
rngC.Formula = strC


With Application.Intersect(Worksheets("pickuptime2") _
.Range("j2:j65526"), Worksheets("pickuptime2").UsedRange.EntireRow)
.Value = .Value
End With

Application.Intersect(Worksheets("pickuptime2") _
.Range("j2:j65526"), Worksheets("pickuptime2").UsedRange.EntireRow)
_
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete

Application.Intersect(Worksheets("pickuptime2") _
.Range("h2:j65526"), Worksheets("pickuptime2").UsedRange.EntireRow)
_
.ClearContents

Set rngA = Nothing
Set rngB = Nothing
Set rngC = Nothing

End Sub
 
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 of Macro on 2 PC misskh Excel Programming 1 July 13th 10 11:46 AM
Speed up macro TGalin Excel Programming 3 October 31st 09 02:16 AM
Need to Speed Up A Macro LostInNY Excel Programming 2 July 20th 09 06:37 PM
Speed Up this macro? Joe2007 Excel Programming 20 November 5th 07 07:18 PM
Speed-up a macro! maca[_3_] Excel Programming 3 July 15th 05 06:40 PM


All times are GMT +1. The time now is 03:30 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"