Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Speed of Macro on 2 PC | Excel Programming | |||
Speed up macro | Excel Programming | |||
Need to Speed Up A Macro | Excel Programming | |||
Speed Up this macro? | Excel Programming | |||
Speed-up a macro! | Excel Programming |