VBA Help

THRASHER69

Board Regular
Joined
Mar 29, 2012
Messages
200
Hello,

I'm hoping some one can help me out. The part of my code listed below really seems to slow my macro down. Anyone know a better way to write this to make it run faster?

VBA Code:
    Set iRow = Range("I2", Range("I2").End(xlDown))

    With iRow
        .FormatConditions.Add Type:=xlExpression, Formula1:= _ 
           "=IF($I2<$G2,TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .Color = vbYellow
                .TintAndShade = 0
            End With
        End With
    End With

    Set iRow1 = Range("J2", Range("J2").End(xlDown))

    With iRow1
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($J2<$G2,TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .Color = vbYellow
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow2 = Range("C2", Range("C2").End(xlDown))

    With iRow2
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF(N2=""Released to Warehouse"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 22
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow3 = Range("E2", Range("E2").End(xlDown))

    With iRow3
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF(N2=""Released to Warehouse"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 22
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow4 = Range("N2", Range("N2").End(xlDown))

    With iRow4
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF(N2=""Released to Warehouse"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 22
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow5 = Range("C1")

    With iRow5
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(N:N,""Released to Warehouse"")"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 22
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow6 = Range("E1") 

    With iRow6
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(N:N,""Released to Warehouse"")" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 22
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow7 = Range("D2", Range("D2").End(xlDown)) 

    With iRow7
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 4
                .TintAndShade = 0
            End With
        End With
    End With
    
     Set iRow8 = Range("N2", Range("N2").End(xlDown))

    With iRow8
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 4
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow9 = Range("C2", Range("C2").End(xlDown))

    With iRow9
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($O2=TODAY(),TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 43
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow10 = Range("O2", Range("O2").End(xlDown)) 

    With iRow10
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($O2=TODAY(),TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 43
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow11 = Range("A2", Range("A2").End(xlDown)) 

    With iRow11
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($P2<>"""",TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 35
                .TintAndShade = 0
            End With
        End With
    End With
    
    LastRow3 = Cells(Rows.Count, "F").End(xlUp).Row 
    
    Set iRow12 = Range("P2:P" & LastRow3)

    With iRow12
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($P2<>"""",TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 35
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow13 = Range("B1")

    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"")"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"")"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"")" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""2040 OREGON STREET,ODESSA,TX,79764,US"")"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"")" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"")" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"")" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"")"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow13
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=COUNTIF(B:B,""8708 WEST LITTLE YORK,SUITE 100,HOUSTON,TX,77040,US"")" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    Set iRow14 = Range("B2", Range("B2").End(xlDown))

    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"",TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""2040 OREGON STREET,ODESSA,TX,79764,US"",TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"",TRUE,FALSE)" 
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"",TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With
    
    With iRow14
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=IF($B2=""8708 WEST LITTLE YORK SUITE 100,HOUSTON,TX,77040,US"",TRUE,FALSE)"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 8
                .TintAndShade = 0
            End With
        End With
    End With

Thank you
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Does the following give you data to work with? It's part of the original data sheet. The original sheet is 31,317 rows but that will get knocked down to around 900 rows after I run my code.

FNDWRR.exe
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBK
1Organization NameOrder ManagerOrder NumberLineCustomerShip To AddressCustomer PO NumberRevenue Business UnitFinal DestinationItem NumberInventory Item Status CodeDescriptionProduct Line Reporting CatQtyReserved QtyOnhand QuantityAvailable QuantityPO and Req Open QuantityWIP Jobs QuantityManufacturing GroupPlanner CodeBuyer CodeSales Order DateDate BookedCustomer Requested DateMFG Completion DateEstimated Ship DatePost MFG Lead TimeDelivery Lead TimePromise DateShip SetOn HoldHold TypePicked DateActual Ship DateOrder Line StatusDelivery IDShipping StatusUOMShipped QtyInvoiced Qty for Entire LineUnit Selling PriceUnit Item Standard CostRig NameRig Name DescriptionRig TypeOrder TypeSales Order CurrencyCurrency Conversion Rate TypeCurrency Conversion RateProjectProject NameProject Task NumberProject Task NameSubjectIncotermsIncoterms LocationScheduled Revenue DaysPayment ScheduleLine TypeOrdered Quantity UOMQty idReservation type
2OUR MFG Inventory 3412332.1Customer 1Address 117525135-001ActivePart 1122003.POL ROD ACCESS A2120.112922700ASSEMBLYBuyer25-MAR-202025-MAR-202016-APR-202016-APR-2020016-APR-2020Awaiting ShippingReady to ReleaseEA57.1357.13INTERNAL ORDER TYPEUSDEXWStandard LineEA44581118
3OUR MFG Inventory 3412331.1Customer 1Address 117524935-001ActivePart 2122003.POL ROD ACCESS A2105.47335ASSEMBLY25-MAR-202025-MAR-202016-APR-202016-APR-2020016-APR-2020Awaiting ShippingReady to ReleaseEA159.82159.82INTERNAL ORDER TYPEUSDEXWStandard LineEA44581120
4OUR MFG Inventory 3412391.1Customer 2Address 217524926-001ActivePart 3122006.PUMPING ACCESS A1290.20202020165ASSEMBLY25-MAR-202025-MAR-202016-APR-202015-APR-2020015-APR-2020Production OpenReady to ReleaseST23.7023.70INTERNAL ORDER TYPEUSDEXWStandard LineST44581134Job or Schedule
5OUR MFG Inventory 3412394.1Customer 2Address 217523338-001ActivePart 4122001.PATCO STUFFING A2990.49797VICBuyer25-MAR-202025-MAR-202016-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseST59.2959.29INTERNAL ORDER TYPEUSDEXWStandard LineST44581127
6OUR MFG Inventory 3412392.1Customer 2Address 217531918-001ActivePart 5122006.PUMPING ACCESS A1201.4287287CARRIEBuyer25-MAR-202025-MAR-202016-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseEA41.5841.58INTERNAL ORDER TYPEUSDEXWStandard LineEA44581128
7OUR MFG Inventory 3412393.1Customer 2Address 217525174-001ActivePart 6122001.STUFFING BOXES A1160.112383ASSEMBLYBuyer25-MAR-202025-MAR-202016-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseST9.019.01INTERNAL ORDER TYPEUSDEXWStandard LineST44581129
8OUR MFG Inventory 3410981.1Customer 3Address 317525155-001ActivePart 7122003.POL ROD ACCESS A2120.6484866MFGBuyer20-MAR-202021-MAR-202025-MAR-2020Booked84.0284.02INTERNAL ORDER TYPEUSDEXWStandard LineEA52559019
9OUR MFG Inventory 3410982.1Customer 3Address 317531597-001ActivePart 8122003.POL ROD ACCESS A219X.3010641064700CONSIGNEDBuyer20-MAR-202021-MAR-202025-MAR-2020Booked5.945.94INTERNAL ORDER TYPEUSDEXWStandard LineEA52559020
10OUR MFG Inventory 3410983.1Customer 3Address 317531876-001ActivePart 9122001.STUFFING BOXES A1170.500050ASSEMBLY20-MAR-202021-MAR-202025-MAR-2020Booked50.8850.88INTERNAL ORDER TYPEUSDEXWStandard LineEA52559021
11OUR MFG Inventory 3410984.1Customer 3Address 317524817-001ActivePart 10122003.POL ROD ACCESS A2190.30101020ASSEMBLY20-MAR-202021-MAR-202025-MAR-2020Booked2.622.62INTERNAL ORDER TYPEUSDEXWStandard LineEA52559022
12OUR MFG Inventory 3411042.1Customer 3Address 317524971-001ActivePart 11122003.POL ROD ACCESS A21S5.1222220ASSEMBLY22-MAR-202022-MAR-202014-APR-202008-APR-2020008-APR-2020Awaiting ShippingReady to ReleaseEA159.42159.42INTERNAL ORDER TYPEUSDEXWStandard LineEA44578133
13OUR MFG Inventory 3411043.1Customer 3Address 317524976-001ActivePart 12122003.POL ROD ACCESS A2120.823441ASSEMBLY22-MAR-202022-MAR-202014-APR-202008-APR-2020008-APR-2020Awaiting ShippingReady to ReleaseEA38.7938.79INTERNAL ORDER TYPEUSDEXWStandard LineEA44578134
14OUR MFG Inventory 3411044.1Customer 3Address 317922557-001ActivePart 13122002.PUMPING ACCESS A1204.220017ASSEMBLY22-MAR-202022-MAR-202011-DEC-202009-DEC-2020009-DEC-2020Production OpenReady to ReleaseEA245.25245.25INTERNAL ORDER TYPEUSDEXWStandard LineEA44578151Job or Schedule
15OUR MFG Inventory 3411041.1Customer 3Address 317524963-001ActivePart 14122001.SURE PAK PACK'G A1163.8008ASSEMBLY22-MAR-202022-MAR-202014-APR-202008-APR-2020008-APR-2020Awaiting ShippingReady to ReleaseST48.0548.05INTERNAL ORDER TYPEUSDEXWStandard LineST44578135
16OUR MFG Inventory 3411046.1Customer 3Address 317532915-001ActivePart 15122003.POL ROD ACCESS A210X.40281043ASSEMBLY22-MAR-202022-MAR-202014-APR-202008-APR-2020008-APR-2020Awaiting ShippingReady to ReleaseEA3.393.39INTERNAL ORDER TYPEUSDEXWStandard LineEA44578136
17OUR MFG Inventory 3411045.1Customer 3Address 317531918-001ActivePart 16122006.PUMPING ACCESS A1201.3287287CARRIEBuyer22-MAR-202022-MAR-202014-APR-202008-APR-2020008-APR-2020Awaiting ShippingReady to ReleaseEA41.5841.58INTERNAL ORDER TYPEUSDEXWStandard LineEA44578137
18OUR MFG Inventory 3411022.1Customer 2Address 217531107-001ActivePart 17122001.BS DPSB NIT DOME A11P6.22222ASSEMBLYBuyer22-MAR-202022-MAR-202027-NOV-202024-NOV-2020024-NOV-2020Production OpenReady to ReleaseEA161.66161.66INTERNAL ORDER TYPEUSDEXWStandard LineEA44578150Job or Schedule
19OUR MFG Inventory 3411021.1Customer 2Address 217525135-001ActivePart 18122003.POL ROD ACCESS A2120.402922700ASSEMBLYBuyer22-MAR-202022-MAR-202014-APR-202014-APR-2020014-APR-2020Awaiting ShippingReady to ReleaseEA57.1357.13INTERNAL ORDER TYPEUSDEXWStandard LineEA44578123
20OUR MFG Inventory 3411038.1Customer 5Address 517522464-001ActivePart 19122006.COMMON PARTS CO A99XX.1183183VICBuyer22-MAR-202022-MAR-202014-APR-202013-APR-2020013-APR-2020Awaiting ShippingReady to ReleaseEA0.750.75INTERNAL ORDER TYPEUSDEXWStandard LineEA44578124
21OUR MFG Inventory 3411035.1Customer 5Address 517532551-001ActivePart 20122001.STUFFING BOXES A1153.3552450ASSEMBLYBuyer22-MAR-202022-MAR-202014-APR-202013-APR-2020013-APR-2020Awaiting ShippingReady to ReleaseEA404.22404.22INTERNAL ORDER TYPEUSDEXWStandard LineEA44578125
22OUR MFG Inventory 3411031.1Customer 5Address 517524938-001ActivePart 21122003.POL ROD ACCESS A2105.32140ASSEMBLYBuyer22-MAR-202022-MAR-202014-APR-202013-APR-2020013-APR-2020Awaiting ShippingReady to ReleaseEA248.68248.68INTERNAL ORDER TYPEUSDEXWStandard LineEA44578126
23OUR MFG Inventory 3411032.1Customer 5Address 517524977-001ActivePart 22122003.POL ROD ACCESS A2120.21414ASSEMBLYBuyer22-MAR-202022-MAR-202014-APR-202013-APR-2020013-APR-2020Awaiting ShippingReady to ReleaseEA57.1957.19INTERNAL ORDER TYPEUSDEXWStandard LineEA44578127
24OUR MFG Inventory 3411047.1Customer 3Address 317523338-001ActivePart 23122001.PATCO STUFFING A2990.59797VICBuyer22-MAR-202022-MAR-202014-APR-202008-APR-2020008-APR-2020Awaiting ShippingReady to ReleaseST59.2959.29INTERNAL ORDER TYPEUSDEXWStandard LineST44578138
25OUR MFG Inventory 3411739.1Customer 3Address 317523338-001ActivePart 24122001.PATCO STUFFING A2990.109797VICBuyer24-MAR-202024-MAR-202015-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseST59.2959.29INTERNAL ORDER TYPEUSDEXWStandard LineST44580118
26OUR MFG Inventory 3411735.1Customer 3Address 317524986-001ActivePart 25122006.PUMPING ACCESS A1290.2000ASSEMBLY24-MAR-202024-MAR-202015-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseST28.6328.63INTERNAL ORDER TYPEUSDEXWStandard LineST44580120
27OUR MFG Inventory 3411732.1Customer 3Address 317524928-001ActivePart 26122003.POL ROD ACCESS A2102.1099ASSEMBLY24-MAR-202024-MAR-202015-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseEA112.70112.70INTERNAL ORDER TYPEUSDEXWStandard LineEA44580122
28OUR MFG Inventory 3411734.1Customer 3Address 317524977-001ActivePart 27122003.POL ROD ACCESS A2120.21414ASSEMBLY24-MAR-202024-MAR-202015-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseEA57.1957.19INTERNAL ORDER TYPEUSDEXWStandard LineEA44580123
29OUR MFG Inventory 3411733.1Customer 3Address 317524934-001ActivePart 28122003.POL ROD ACCESS A2105.600ASSEMBLY24-MAR-202024-MAR-202015-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseEA286.28286.28INTERNAL ORDER TYPEUSDEXWStandard LineEA44580124
30OUR MFG Inventory 3411731.1Customer 3Address 317524924-001ActivePart 29122003.POL ROD ACCESS A2120.1400ASSEMBLY24-MAR-202024-MAR-202015-APR-202015-APR-2020015-APR-2020Awaiting ShippingReady to ReleaseEA80.1780.17INTERNAL ORDER TYPEUSDEXWStandard LineEA44580125
NOV 3164 Order-Ship Details 0
 
Upvote 0
If you start of with 31,000 rows, the loops will definitely be slowing things down
At the moment you are deleting rows based on col AJ & from the sample of your data col Al has ready to be released for those rows that need to be kept.
Is this always the case?
 
Upvote 0
The message box said 0.0546875

You should extend Fluff's example by methodically adding timer statements throughout your code to identify via measurement where it is slowing down. Example:
VBA Code:
Private Sub Import()

    Dim rng As Range
    Dim rg As Range
    Dim cond1 As FormatCondition
    Dim workrange As Range
    Dim Firstrow As Integer
    Dim LastRow As Integer
    Dim Lrow As Integer
    Dim LastRow1 As Long
    Dim LastRow2 As Long
    Dim LastRow3 As Long
    Dim i As Long
    Dim iRow As Range, cell As Range
    Dim iRow1 As Range
    Dim iRow2 As Range
    Dim iRow3 As Range
    Dim iRow4 As Range
    Dim iRow5 As Range
    Dim iRow6 As Range
    Dim iRow7 As Range
    Dim iRow8 As Range
    Dim iRow9 As Range
    Dim iRow10 As Range
    Dim iRow11 As Range
    Dim iRow12 As Range
    Dim iRow13 As Range
    Dim iRow14 As Range
    Dim r As Range


    Dim ST As Single, S As String                     'for code execution timer
    ST = Timer                                        'for code execution timer

    Application.Calculation = xlCalculationManual
    Application.ScreenUpdating = False
    Application.DisplayStatusBar = False
    Application.EnableEvents = False
    Application.PrintCommunication = False

    If WorksheetExists("Orders") Then
    Else


        Sheets("DO Ship Days").Visible = True
        Sheets.Add.Name = "Orders"
        Sheets("Orders").Move after:=Sheets("Sheet1")

        Sheets("Orders").Activate

        For Each w In Workbooks
            If w.Name Like "*FNDWRR*" Or w.Name Like "*3164*" Then
                Windows(w.Name).Activate
                Cells.Select
                Selection.Copy
                Windows("Oracle Orders.xlsm").Activate
                Cells.Select
                ActiveSheet.Paste
                Exit For
            End If
        Next w

        S = S & "Elaped time for Section 1 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer                                    'for code execution timer

        'Find first and last used row
        Range("AJ:AJ").Select                         ' Order Line Status
        Firstrow = ActiveSheet.UsedRange.Cells(1).Row
        LastRow = Cells(Rows.count, "AJ").End(xlUp).Row

        'Loop through used cells backwards and delete if needed
        For Lrow = LastRow To Firstrow Step -1
            Set workrange = Cells(Lrow, "AJ")
            If workrange.Value <> "Awaiting Fulfillment " _
               And workrange.Value <> "Awaiting Shipping" _
               And workrange.Value <> "Order Line Status" _
               And workrange.Value <> "Picked Partial  " _
               And workrange.Value <> "Closed " _
               And workrange.Value <> "Picked " _
               And workrange.Value <> "Production Open" _
               And workrange.Value <> "Production Partial" _
               And workrange.Value <> "Shipped" _
               And workrange.Value <> "Supply Eligible" _
               And workrange.Value <> "Ready To Release" _
               Then workrange.EntireRow.Delete
        Next Lrow


        S = S & "Elaped time for Section 2 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer


        LastRow3 = Cells(Rows.count, "E").End(xlUp).Row

        For Each r In Range("AL2:AL" & LastRow3)
            If r = "" Then r = r.Offset(, -2).Value
        Next

        ActiveSheet.Cells.Font.Name = "Kurale"
        ActiveSheet.Cells.Font.Size = 12


        Range("A:A,G:H,K:K,M:M,T:T,V:V,AB:AC,AM:AM,AO:AO,AR:AT,AV:BL").Delete

        Range("B1").Value = "Order#"
        Range("J1").Value = "Rsvd"
        Range("K1").Value = "OH"
        Range("L1").Value = "Avbl"
        Range("M1").Value = "PO/Req Qty"
        Range("N1").Value = "WIP"
        Range("S1").Value = "Ship Date"

        Sheets("Orders").AutoFilterMode = False
        Range("A1:AG1").AutoFilter
        Columns("A:AG").EntireColumn.AutoFit

        With Range("A:AG")
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
        End With

        S = S & "Elaped time for Section 3 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer


        Columns("D:E").Cut
        Columns("A").Insert Shift:=xlToRight

        Columns("C").Cut                              ' Order Manager
        Columns("AH").Insert Shift:=xlToRight

        Columns("F:M").Cut
        Columns("D").Insert Shift:=xlToRight

        Columns("Z").Cut                              ' Order Line Status
        Columns("L").Insert Shift:=xlToRight

        Columns("AB").Cut                             ' Shipping Status
        Columns("M").Insert Shift:=xlToRight

        Columns("T").Cut                              ' Ship Date
        Columns("N").Insert Shift:=xlToRight

        Columns("W").Cut                              ' Ship Set
        Columns("O").Insert Shift:=xlToRight

        Columns("AD").Cut
        Columns("P").Insert Shift:=xlToRight

        Columns("AC").Cut
        Columns("Q").Insert Shift:=xlToRight

        Columns("AE").Cut                             ' Unit Standard Cost
        Columns("Q").Insert Shift:=xlToRight

        Range("R1").Value = "Delivery#"
        Range("D1").Value = "Item#"

        Columns("Q").Insert Shift:=xlToRight

        Range("Q1").Value = "Line Total"


        S = S & "Elaped time for Section 4 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        LastRow2 = Cells(Rows.count, "A").End(xlUp).Row
        Range("Q2:Q" & LastRow2).Formula = "=SUM(P2*F2)"

        Range("A:B,E:E,L:M,U:AH").NumberFormat = "@"
        Range("C:D,F:K,O:O,S:T").NumberFormat = "0.00"
        Range("P:R").NumberFormat = "$#,##0.00"

        Columns("A:AH").EntireColumn.AutoFit

        Columns("A:B").ColumnWidth = 20
        Columns("E:E").ColumnWidth = 24
        Columns("L:L").ColumnWidth = 10

        Columns("A:B").HorizontalAlignment = xlLeft
        Columns("E:E").HorizontalAlignment = xlLeft

        Application.CutCopyMode = False

        ActiveWindow.FreezePanes = False
        Range("D2").Select
        ActiveWindow.FreezePanes = True

        Sheets("Orders").Activate

        Lrow = Range("A" & Rows.count).End(xlUp).Row
        Set rng = Range("A1:AH" & Lrow)

        With rng.Borders
            .LineStyle = xlContinuous
            .Color = vbBlack
            .Weight = xlThin
        End With

        Columns("Q").Cut                              ' Line Total
        Columns("D").Insert Shift:=xlToRight

        Sheets("Orders").AutoFilterMode = False
        Range("A1:AH1").AutoFilter

        Range("G:J").NumberFormat = "0"


        S = S & "Elaped time for Section 5 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Columns("G:G").TextToColumns Destination:=Range("G1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("H:H").TextToColumns Destination:=Range("H1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("I:I").TextToColumns Destination:=Range("I1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("J:J").TextToColumns Destination:=Range("J1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True


        S = S & "Elaped time for Section 6 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Set iRow = Range("I2", Range("I2").End(xlDown))

        With iRow
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($I2<$G2,TRUE,FALSE)"    ' IF($OH < Qty ,TRUE,FALSE)
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .Color = vbYellow
                    .TintAndShade = 0
                End With
            End With
        End With

        S = S & "Elaped time for Section 7 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Set iRow1 = Range("J2", Range("J2").End(xlDown))    'Avbl

        With iRow1
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($J2<$G2,TRUE,FALSE)"    ' IF(Avbl < Qty ,TRUE,FALSE)
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .Color = vbYellow
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow2 = Range("C2", Range("C2").End(xlDown))

        With iRow2
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow3 = Range("E2", Range("E2").End(xlDown))    ' Item#

        With iRow3
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow4 = Range("N2", Range("N2").End(xlDown))

        With iRow4
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow5 = Range("C1")

        With iRow5
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(N:N,""Released to Warehouse"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow6 = Range("E1")

        With iRow6
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(N:N,""Released to Warehouse"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow7 = Range("D2", Range("D2").End(xlDown))

        With iRow7
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 4
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow8 = Range("N2", Range("N2").End(xlDown))

        With iRow8
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 4
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow9 = Range("C2", Range("C2").End(xlDown))

        With iRow9
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($O2=TODAY(),TRUE,FALSE)"    ' Ship Date
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 43
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow10 = Range("O2", Range("O2").End(xlDown))

        With iRow10
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($O2=TODAY(),TRUE,FALSE)"    ' Ship Date
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 43
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow11 = Range("A2", Range("A2").End(xlDown))

        With iRow11
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($P2<>"""",TRUE,FALSE)"    ' Ship Set
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 35
                    .TintAndShade = 0
                End With
            End With
        End With

        LastRow3 = Cells(Rows.count, "F").End(xlUp).Row

        Set iRow12 = Range("P2:P" & LastRow3)         ' Ship Set

        With iRow12
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($P2<>"""",TRUE,FALSE)"    ' Ship Set
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 35
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow13 = Range("B1")

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""2040 OREGON STREET,ODESSA,TX,79764,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""8708 WEST LITTLE YORK,SUITE 100,HOUSTON,TX,77040,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow14 = Range("B2", Range("B2").End(xlDown))

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""2040 OREGON STREET,ODESSA,TX,79764,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""8708 WEST LITTLE YORK SUITE 100,HOUSTON,TX,77040,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        S = S & "Elaped time for Section 8 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Columns("O:O").Select
        Selection.TextToColumns Destination:=Range("O1"), DataType:=xlDelimited, _
                                TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                            :=Array(1, 7), TrailingMinusNumbers:=True    ' Ship Date

        Columns("T").Cut
        Columns("F").Insert Shift:=xlToRight

        Columns("AG").Cut                             ' Order Type
        Columns("R").Insert Shift:=xlToRight

        Columns("A:AH").EntireColumn.AutoFit

        Columns("A:B").ColumnWidth = 20               ' Customer
        Columns("G:G").ColumnWidth = 20               ' Description
        Columns("H:M").ColumnWidth = 9                ' Qty,Rsvd,OH,Avbl,PO/Req Qty,WIP


        Range("A1").Activate

        For Each w In Workbooks
            If w.Name Like "*FNDWRR*" Or w.Name Like "*3164*" Then
                Windows(w.Name).Activate
                ActiveWorkbook.Close Savechanges:=False
                Exit For
            End If
        Next w

        Sheets("Sheet1").Visible = False

    End If

    Application.PrintCommunication = True
    Application.EnableEvents = True
    Application.DisplayStatusBar = True
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic

    S = S & "Elaped time for Section 5 = " & Timer - ST & vbCr    'for code execution timer
    MsgBox S
End Sub
 
Upvote 0
If you start of with 31,000 rows, the loops will definitely be slowing things down
At the moment you are deleting rows based on col AJ & from the sample of your data col Al has ready to be released for those rows that need to be kept.
Is this always the case?
No, that is not always the case. Column AI has 3 or 4 others besides ready to release. There is backordered, staged/pick confirmed and a couple of others I can't think of at the moment.
 
Upvote 0
You should extend Fluff's example by methodically adding timer statements throughout your code to identify via measurement where it is slowing down. Example:
VBA Code:
Private Sub Import()

    Dim rng As Range
    Dim rg As Range
    Dim cond1 As FormatCondition
    Dim workrange As Range
    Dim Firstrow As Integer
    Dim LastRow As Integer
    Dim Lrow As Integer
    Dim LastRow1 As Long
    Dim LastRow2 As Long
    Dim LastRow3 As Long
    Dim i As Long
    Dim iRow As Range, cell As Range
    Dim iRow1 As Range
    Dim iRow2 As Range
    Dim iRow3 As Range
    Dim iRow4 As Range
    Dim iRow5 As Range
    Dim iRow6 As Range
    Dim iRow7 As Range
    Dim iRow8 As Range
    Dim iRow9 As Range
    Dim iRow10 As Range
    Dim iRow11 As Range
    Dim iRow12 As Range
    Dim iRow13 As Range
    Dim iRow14 As Range
    Dim r As Range


    Dim ST As Single, S As String                     'for code execution timer
    ST = Timer                                        'for code execution timer

    Application.Calculation = xlCalculationManual
    Application.ScreenUpdating = False
    Application.DisplayStatusBar = False
    Application.EnableEvents = False
    Application.PrintCommunication = False

    If WorksheetExists("Orders") Then
    Else


        Sheets("DO Ship Days").Visible = True
        Sheets.Add.Name = "Orders"
        Sheets("Orders").Move after:=Sheets("Sheet1")

        Sheets("Orders").Activate

        For Each w In Workbooks
            If w.Name Like "*FNDWRR*" Or w.Name Like "*3164*" Then
                Windows(w.Name).Activate
                Cells.Select
                Selection.Copy
                Windows("Oracle Orders.xlsm").Activate
                Cells.Select
                ActiveSheet.Paste
                Exit For
            End If
        Next w

        S = S & "Elaped time for Section 1 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer                                    'for code execution timer

        'Find first and last used row
        Range("AJ:AJ").Select                         ' Order Line Status
        Firstrow = ActiveSheet.UsedRange.Cells(1).Row
        LastRow = Cells(Rows.count, "AJ").End(xlUp).Row

        'Loop through used cells backwards and delete if needed
        For Lrow = LastRow To Firstrow Step -1
            Set workrange = Cells(Lrow, "AJ")
            If workrange.Value <> "Awaiting Fulfillment " _
               And workrange.Value <> "Awaiting Shipping" _
               And workrange.Value <> "Order Line Status" _
               And workrange.Value <> "Picked Partial  " _
               And workrange.Value <> "Closed " _
               And workrange.Value <> "Picked " _
               And workrange.Value <> "Production Open" _
               And workrange.Value <> "Production Partial" _
               And workrange.Value <> "Shipped" _
               And workrange.Value <> "Supply Eligible" _
               And workrange.Value <> "Ready To Release" _
               Then workrange.EntireRow.Delete
        Next Lrow


        S = S & "Elaped time for Section 2 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer


        LastRow3 = Cells(Rows.count, "E").End(xlUp).Row

        For Each r In Range("AL2:AL" & LastRow3)
            If r = "" Then r = r.Offset(, -2).Value
        Next

        ActiveSheet.Cells.Font.Name = "Kurale"
        ActiveSheet.Cells.Font.Size = 12


        Range("A:A,G:H,K:K,M:M,T:T,V:V,AB:AC,AM:AM,AO:AO,AR:AT,AV:BL").Delete

        Range("B1").Value = "Order#"
        Range("J1").Value = "Rsvd"
        Range("K1").Value = "OH"
        Range("L1").Value = "Avbl"
        Range("M1").Value = "PO/Req Qty"
        Range("N1").Value = "WIP"
        Range("S1").Value = "Ship Date"

        Sheets("Orders").AutoFilterMode = False
        Range("A1:AG1").AutoFilter
        Columns("A:AG").EntireColumn.AutoFit

        With Range("A:AG")
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
        End With

        S = S & "Elaped time for Section 3 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer


        Columns("D:E").Cut
        Columns("A").Insert Shift:=xlToRight

        Columns("C").Cut                              ' Order Manager
        Columns("AH").Insert Shift:=xlToRight

        Columns("F:M").Cut
        Columns("D").Insert Shift:=xlToRight

        Columns("Z").Cut                              ' Order Line Status
        Columns("L").Insert Shift:=xlToRight

        Columns("AB").Cut                             ' Shipping Status
        Columns("M").Insert Shift:=xlToRight

        Columns("T").Cut                              ' Ship Date
        Columns("N").Insert Shift:=xlToRight

        Columns("W").Cut                              ' Ship Set
        Columns("O").Insert Shift:=xlToRight

        Columns("AD").Cut
        Columns("P").Insert Shift:=xlToRight

        Columns("AC").Cut
        Columns("Q").Insert Shift:=xlToRight

        Columns("AE").Cut                             ' Unit Standard Cost
        Columns("Q").Insert Shift:=xlToRight

        Range("R1").Value = "Delivery#"
        Range("D1").Value = "Item#"

        Columns("Q").Insert Shift:=xlToRight

        Range("Q1").Value = "Line Total"


        S = S & "Elaped time for Section 4 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        LastRow2 = Cells(Rows.count, "A").End(xlUp).Row
        Range("Q2:Q" & LastRow2).Formula = "=SUM(P2*F2)"

        Range("A:B,E:E,L:M,U:AH").NumberFormat = "@"
        Range("C:D,F:K,O:O,S:T").NumberFormat = "0.00"
        Range("P:R").NumberFormat = "$#,##0.00"

        Columns("A:AH").EntireColumn.AutoFit

        Columns("A:B").ColumnWidth = 20
        Columns("E:E").ColumnWidth = 24
        Columns("L:L").ColumnWidth = 10

        Columns("A:B").HorizontalAlignment = xlLeft
        Columns("E:E").HorizontalAlignment = xlLeft

        Application.CutCopyMode = False

        ActiveWindow.FreezePanes = False
        Range("D2").Select
        ActiveWindow.FreezePanes = True

        Sheets("Orders").Activate

        Lrow = Range("A" & Rows.count).End(xlUp).Row
        Set rng = Range("A1:AH" & Lrow)

        With rng.Borders
            .LineStyle = xlContinuous
            .Color = vbBlack
            .Weight = xlThin
        End With

        Columns("Q").Cut                              ' Line Total
        Columns("D").Insert Shift:=xlToRight

        Sheets("Orders").AutoFilterMode = False
        Range("A1:AH1").AutoFilter

        Range("G:J").NumberFormat = "0"


        S = S & "Elaped time for Section 5 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Columns("G:G").TextToColumns Destination:=Range("G1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("H:H").TextToColumns Destination:=Range("H1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("I:I").TextToColumns Destination:=Range("I1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("J:J").TextToColumns Destination:=Range("J1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True


        S = S & "Elaped time for Section 6 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Set iRow = Range("I2", Range("I2").End(xlDown))

        With iRow
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($I2<$G2,TRUE,FALSE)"    ' IF($OH < Qty ,TRUE,FALSE)
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .Color = vbYellow
                    .TintAndShade = 0
                End With
            End With
        End With

        S = S & "Elaped time for Section 7 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Set iRow1 = Range("J2", Range("J2").End(xlDown))    'Avbl

        With iRow1
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($J2<$G2,TRUE,FALSE)"    ' IF(Avbl < Qty ,TRUE,FALSE)
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .Color = vbYellow
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow2 = Range("C2", Range("C2").End(xlDown))

        With iRow2
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow3 = Range("E2", Range("E2").End(xlDown))    ' Item#

        With iRow3
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow4 = Range("N2", Range("N2").End(xlDown))

        With iRow4
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow5 = Range("C1")

        With iRow5
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(N:N,""Released to Warehouse"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow6 = Range("E1")

        With iRow6
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(N:N,""Released to Warehouse"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow7 = Range("D2", Range("D2").End(xlDown))

        With iRow7
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 4
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow8 = Range("N2", Range("N2").End(xlDown))

        With iRow8
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 4
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow9 = Range("C2", Range("C2").End(xlDown))

        With iRow9
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($O2=TODAY(),TRUE,FALSE)"    ' Ship Date
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 43
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow10 = Range("O2", Range("O2").End(xlDown))

        With iRow10
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($O2=TODAY(),TRUE,FALSE)"    ' Ship Date
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 43
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow11 = Range("A2", Range("A2").End(xlDown))

        With iRow11
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($P2<>"""",TRUE,FALSE)"    ' Ship Set
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 35
                    .TintAndShade = 0
                End With
            End With
        End With

        LastRow3 = Cells(Rows.count, "F").End(xlUp).Row

        Set iRow12 = Range("P2:P" & LastRow3)         ' Ship Set

        With iRow12
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($P2<>"""",TRUE,FALSE)"    ' Ship Set
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 35
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow13 = Range("B1")

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""2040 OREGON STREET,ODESSA,TX,79764,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""8708 WEST LITTLE YORK,SUITE 100,HOUSTON,TX,77040,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow14 = Range("B2", Range("B2").End(xlDown))

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""2040 OREGON STREET,ODESSA,TX,79764,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""8708 WEST LITTLE YORK SUITE 100,HOUSTON,TX,77040,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        S = S & "Elaped time for Section 8 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Columns("O:O").Select
        Selection.TextToColumns Destination:=Range("O1"), DataType:=xlDelimited, _
                                TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                            :=Array(1, 7), TrailingMinusNumbers:=True    ' Ship Date

        Columns("T").Cut
        Columns("F").Insert Shift:=xlToRight

        Columns("AG").Cut                             ' Order Type
        Columns("R").Insert Shift:=xlToRight

        Columns("A:AH").EntireColumn.AutoFit

        Columns("A:B").ColumnWidth = 20               ' Customer
        Columns("G:G").ColumnWidth = 20               ' Description
        Columns("H:M").ColumnWidth = 9                ' Qty,Rsvd,OH,Avbl,PO/Req Qty,WIP


        Range("A1").Activate

        For Each w In Workbooks
            If w.Name Like "*FNDWRR*" Or w.Name Like "*3164*" Then
                Windows(w.Name).Activate
                ActiveWorkbook.Close Savechanges:=False
                Exit For
            End If
        Next w

        Sheets("Sheet1").Visible = False

    End If

    Application.PrintCommunication = True
    Application.EnableEvents = True
    Application.DisplayStatusBar = True
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic

    S = S & "Elaped time for Section 5 = " & Timer - ST & vbCr    'for code execution timer
    MsgBox S
End Sub
I will try this and see what I get. Thanks
 
Upvote 0
You should extend Fluff's example by methodically adding timer statements throughout your code to identify via measurement where it is slowing down. Example:
VBA Code:
Private Sub Import()

    Dim rng As Range
    Dim rg As Range
    Dim cond1 As FormatCondition
    Dim workrange As Range
    Dim Firstrow As Integer
    Dim LastRow As Integer
    Dim Lrow As Integer
    Dim LastRow1 As Long
    Dim LastRow2 As Long
    Dim LastRow3 As Long
    Dim i As Long
    Dim iRow As Range, cell As Range
    Dim iRow1 As Range
    Dim iRow2 As Range
    Dim iRow3 As Range
    Dim iRow4 As Range
    Dim iRow5 As Range
    Dim iRow6 As Range
    Dim iRow7 As Range
    Dim iRow8 As Range
    Dim iRow9 As Range
    Dim iRow10 As Range
    Dim iRow11 As Range
    Dim iRow12 As Range
    Dim iRow13 As Range
    Dim iRow14 As Range
    Dim r As Range


    Dim ST As Single, S As String                     'for code execution timer
    ST = Timer                                        'for code execution timer

    Application.Calculation = xlCalculationManual
    Application.ScreenUpdating = False
    Application.DisplayStatusBar = False
    Application.EnableEvents = False
    Application.PrintCommunication = False

    If WorksheetExists("Orders") Then
    Else


        Sheets("DO Ship Days").Visible = True
        Sheets.Add.Name = "Orders"
        Sheets("Orders").Move after:=Sheets("Sheet1")

        Sheets("Orders").Activate

        For Each w In Workbooks
            If w.Name Like "*FNDWRR*" Or w.Name Like "*3164*" Then
                Windows(w.Name).Activate
                Cells.Select
                Selection.Copy
                Windows("Oracle Orders.xlsm").Activate
                Cells.Select
                ActiveSheet.Paste
                Exit For
            End If
        Next w

        S = S & "Elaped time for Section 1 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer                                    'for code execution timer

        'Find first and last used row
        Range("AJ:AJ").Select                         ' Order Line Status
        Firstrow = ActiveSheet.UsedRange.Cells(1).Row
        LastRow = Cells(Rows.count, "AJ").End(xlUp).Row

        'Loop through used cells backwards and delete if needed
        For Lrow = LastRow To Firstrow Step -1
            Set workrange = Cells(Lrow, "AJ")
            If workrange.Value <> "Awaiting Fulfillment " _
               And workrange.Value <> "Awaiting Shipping" _
               And workrange.Value <> "Order Line Status" _
               And workrange.Value <> "Picked Partial  " _
               And workrange.Value <> "Closed " _
               And workrange.Value <> "Picked " _
               And workrange.Value <> "Production Open" _
               And workrange.Value <> "Production Partial" _
               And workrange.Value <> "Shipped" _
               And workrange.Value <> "Supply Eligible" _
               And workrange.Value <> "Ready To Release" _
               Then workrange.EntireRow.Delete
        Next Lrow


        S = S & "Elaped time for Section 2 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer


        LastRow3 = Cells(Rows.count, "E").End(xlUp).Row

        For Each r In Range("AL2:AL" & LastRow3)
            If r = "" Then r = r.Offset(, -2).Value
        Next

        ActiveSheet.Cells.Font.Name = "Kurale"
        ActiveSheet.Cells.Font.Size = 12


        Range("A:A,G:H,K:K,M:M,T:T,V:V,AB:AC,AM:AM,AO:AO,AR:AT,AV:BL").Delete

        Range("B1").Value = "Order#"
        Range("J1").Value = "Rsvd"
        Range("K1").Value = "OH"
        Range("L1").Value = "Avbl"
        Range("M1").Value = "PO/Req Qty"
        Range("N1").Value = "WIP"
        Range("S1").Value = "Ship Date"

        Sheets("Orders").AutoFilterMode = False
        Range("A1:AG1").AutoFilter
        Columns("A:AG").EntireColumn.AutoFit

        With Range("A:AG")
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
        End With

        S = S & "Elaped time for Section 3 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer


        Columns("D:E").Cut
        Columns("A").Insert Shift:=xlToRight

        Columns("C").Cut                              ' Order Manager
        Columns("AH").Insert Shift:=xlToRight

        Columns("F:M").Cut
        Columns("D").Insert Shift:=xlToRight

        Columns("Z").Cut                              ' Order Line Status
        Columns("L").Insert Shift:=xlToRight

        Columns("AB").Cut                             ' Shipping Status
        Columns("M").Insert Shift:=xlToRight

        Columns("T").Cut                              ' Ship Date
        Columns("N").Insert Shift:=xlToRight

        Columns("W").Cut                              ' Ship Set
        Columns("O").Insert Shift:=xlToRight

        Columns("AD").Cut
        Columns("P").Insert Shift:=xlToRight

        Columns("AC").Cut
        Columns("Q").Insert Shift:=xlToRight

        Columns("AE").Cut                             ' Unit Standard Cost
        Columns("Q").Insert Shift:=xlToRight

        Range("R1").Value = "Delivery#"
        Range("D1").Value = "Item#"

        Columns("Q").Insert Shift:=xlToRight

        Range("Q1").Value = "Line Total"


        S = S & "Elaped time for Section 4 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        LastRow2 = Cells(Rows.count, "A").End(xlUp).Row
        Range("Q2:Q" & LastRow2).Formula = "=SUM(P2*F2)"

        Range("A:B,E:E,L:M,U:AH").NumberFormat = "@"
        Range("C:D,F:K,O:O,S:T").NumberFormat = "0.00"
        Range("P:R").NumberFormat = "$#,##0.00"

        Columns("A:AH").EntireColumn.AutoFit

        Columns("A:B").ColumnWidth = 20
        Columns("E:E").ColumnWidth = 24
        Columns("L:L").ColumnWidth = 10

        Columns("A:B").HorizontalAlignment = xlLeft
        Columns("E:E").HorizontalAlignment = xlLeft

        Application.CutCopyMode = False

        ActiveWindow.FreezePanes = False
        Range("D2").Select
        ActiveWindow.FreezePanes = True

        Sheets("Orders").Activate

        Lrow = Range("A" & Rows.count).End(xlUp).Row
        Set rng = Range("A1:AH" & Lrow)

        With rng.Borders
            .LineStyle = xlContinuous
            .Color = vbBlack
            .Weight = xlThin
        End With

        Columns("Q").Cut                              ' Line Total
        Columns("D").Insert Shift:=xlToRight

        Sheets("Orders").AutoFilterMode = False
        Range("A1:AH1").AutoFilter

        Range("G:J").NumberFormat = "0"


        S = S & "Elaped time for Section 5 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Columns("G:G").TextToColumns Destination:=Range("G1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("H:H").TextToColumns Destination:=Range("H1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("I:I").TextToColumns Destination:=Range("I1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True

        Columns("J:J").TextToColumns Destination:=Range("J1"), DataType:=xlDelimited, _
                                     TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                     Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                                 :=Array(1, 1), TrailingMinusNumbers:=True


        S = S & "Elaped time for Section 6 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Set iRow = Range("I2", Range("I2").End(xlDown))

        With iRow
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($I2<$G2,TRUE,FALSE)"    ' IF($OH < Qty ,TRUE,FALSE)
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .Color = vbYellow
                    .TintAndShade = 0
                End With
            End With
        End With

        S = S & "Elaped time for Section 7 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Set iRow1 = Range("J2", Range("J2").End(xlDown))    'Avbl

        With iRow1
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($J2<$G2,TRUE,FALSE)"    ' IF(Avbl < Qty ,TRUE,FALSE)
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .Color = vbYellow
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow2 = Range("C2", Range("C2").End(xlDown))

        With iRow2
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow3 = Range("E2", Range("E2").End(xlDown))    ' Item#

        With iRow3
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow4 = Range("N2", Range("N2").End(xlDown))

        With iRow4
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF(N2=""Released to Warehouse"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow5 = Range("C1")

        With iRow5
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(N:N,""Released to Warehouse"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow6 = Range("E1")

        With iRow6
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(N:N,""Released to Warehouse"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 22
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow7 = Range("D2", Range("D2").End(xlDown))

        With iRow7
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 4
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow8 = Range("N2", Range("N2").End(xlDown))

        With iRow8
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($N2=""Staged/Pick Confirmed"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 4
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow9 = Range("C2", Range("C2").End(xlDown))

        With iRow9
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($O2=TODAY(),TRUE,FALSE)"    ' Ship Date
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 43
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow10 = Range("O2", Range("O2").End(xlDown))

        With iRow10
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($O2=TODAY(),TRUE,FALSE)"    ' Ship Date
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 43
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow11 = Range("A2", Range("A2").End(xlDown))

        With iRow11
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($P2<>"""",TRUE,FALSE)"    ' Ship Set
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 35
                    .TintAndShade = 0
                End With
            End With
        End With

        LastRow3 = Cells(Rows.count, "F").End(xlUp).Row

        Set iRow12 = Range("P2:P" & LastRow3)         ' Ship Set

        With iRow12
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($P2<>"""",TRUE,FALSE)"    ' Ship Set
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 35
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow13 = Range("B1")

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""2040 OREGON STREET,ODESSA,TX,79764,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow13
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=COUNTIF(B:B,""8708 WEST LITTLE YORK,SUITE 100,HOUSTON,TX,77040,US"")"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        Set iRow14 = Range("B2", Range("B2").End(xlDown))

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""1320 EAST LOS ANGELES AVENUE,SHAFTER,CA,93263,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""10353 RICHMOND AVENUE,HOUSTON,TX,77042,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""19417 COLOMBO STREET,BAKERSFIELD,CA,93308,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""2040 OREGON STREET,ODESSA,TX,79764,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""1444 NORTH DERRICK DRIVE,CASPER,WY,82604,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""10906 FM 2920 ROAD,TOMBALL,TX,77375,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""21255 LA HIGHWAY 1 SOUTH,PLAQUEMINE,LA,70764,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""9870 EAST 30TH STREET,INDIANAPOLIS,IN,46229,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        With iRow14
            .FormatConditions.Add Type:=xlExpression, Formula1:= _
                                                                "=IF($B2=""8708 WEST LITTLE YORK SUITE 100,HOUSTON,TX,77040,US"",TRUE,FALSE)"
            With .FormatConditions(.FormatConditions.count)
                .SetFirstPriority
                With .Interior
                    .PatternColorIndex = xlAutomatic
                    .ColorIndex = 8
                    .TintAndShade = 0
                End With
            End With
        End With

        S = S & "Elaped time for Section 8 = " & Timer - ST & vbCr    'for code execution timer
        ST = Timer

        Columns("O:O").Select
        Selection.TextToColumns Destination:=Range("O1"), DataType:=xlDelimited, _
                                TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                                Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                                                                                            :=Array(1, 7), TrailingMinusNumbers:=True    ' Ship Date

        Columns("T").Cut
        Columns("F").Insert Shift:=xlToRight

        Columns("AG").Cut                             ' Order Type
        Columns("R").Insert Shift:=xlToRight

        Columns("A:AH").EntireColumn.AutoFit

        Columns("A:B").ColumnWidth = 20               ' Customer
        Columns("G:G").ColumnWidth = 20               ' Description
        Columns("H:M").ColumnWidth = 9                ' Qty,Rsvd,OH,Avbl,PO/Req Qty,WIP


        Range("A1").Activate

        For Each w In Workbooks
            If w.Name Like "*FNDWRR*" Or w.Name Like "*3164*" Then
                Windows(w.Name).Activate
                ActiveWorkbook.Close Savechanges:=False
                Exit For
            End If
        Next w

        Sheets("Sheet1").Visible = False

    End If

    Application.PrintCommunication = True
    Application.EnableEvents = True
    Application.DisplayStatusBar = True
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic

    S = S & "Elaped time for Section 5 = " & Timer - ST & vbCr    'for code execution timer
    MsgBox S
End Sub

Here is what the times looked like based on your code:

Elapsed time for Section 1 = 4.871094
Elapsed time for Section 2 = 492.6602
Elapsed time for Section 3 = 1.5
Elapsed time for Section 4 = 9.359375
Elapsed time for Section 5 = 2.34375
Elapsed time for Section 6 = 0.09375
Elapsed time for Section 7 = 3.90625E-03
Elapsed time for Section 8 = 0.0546875
Elapsed time for Section 5 = 3.09375
 
Upvote 0
Ok, thanks for that. Replace this
VBA Code:
        'Loop through used cells backwards and delete if needed
        For Lrow = LastRow To Firstrow Step -1
            Set workrange = Cells(Lrow, "AJ")
            If workrange.Value <> "Awaiting Fulfillment " _
               And workrange.Value <> "Awaiting Shipping" _
               And workrange.Value <> "Order Line Status" _
               And workrange.Value <> "Picked Partial  " _
               And workrange.Value <> "Closed " _
               And workrange.Value <> "Picked " _
               And workrange.Value <> "Production Open" _
               And workrange.Value <> "Production Partial" _
               And workrange.Value <> "Shipped" _
               And workrange.Value <> "Supply Eligible" _
               And workrange.Value <> "Ready To Release" _
               Then workrange.EntireRow.Delete
        Next Lrow
with
VBA Code:
      With Range("BL1:BL" & LastRow)
         .Formula = "=or(AJ1={""Awaiting Fulfillment "",""Awaiting Shipping"",""Order Line Status"",""Picked Partial  "",""Closed "",""Picked "",""Production Open"",""Production Partial"",""Shipped"",""Supply Eligible"",""Ready To Release""})"
         .AutoFilter 1, False
         .Parent.AutoFilter.Range.Offset(1).EntireRow.Delete
         .AutoFilter
         .ClearContents
      End With
which should speed things up.
 
Upvote 0
Ok, thanks for that. Replace this
VBA Code:
        'Loop through used cells backwards and delete if needed
        For Lrow = LastRow To Firstrow Step -1
            Set workrange = Cells(Lrow, "AJ")
            If workrange.Value <> "Awaiting Fulfillment " _
               And workrange.Value <> "Awaiting Shipping" _
               And workrange.Value <> "Order Line Status" _
               And workrange.Value <> "Picked Partial  " _
               And workrange.Value <> "Closed " _
               And workrange.Value <> "Picked " _
               And workrange.Value <> "Production Open" _
               And workrange.Value <> "Production Partial" _
               And workrange.Value <> "Shipped" _
               And workrange.Value <> "Supply Eligible" _
               And workrange.Value <> "Ready To Release" _
               Then workrange.EntireRow.Delete
        Next Lrow
with
VBA Code:
      With Range("BL1:BL" & LastRow)
         .Formula = "=or(AJ1={""Awaiting Fulfillment "",""Awaiting Shipping"",""Order Line Status"",""Picked Partial  "",""Closed "",""Picked "",""Production Open"",""Production Partial"",""Shipped"",""Supply Eligible"",""Ready To Release""})"
         .AutoFilter 1, False
         .Parent.AutoFilter.Range.Offset(1).EntireRow.Delete
         .AutoFilter
         .ClearContents
      End With
which should speed things up.

Wow, That made a big difference with that part. Thank you very much.

Elapsed time for Section 1 = 6.921875
Elapsed time for Section 2 = 8.929688
Elapsed time for Section 3 = 1.976563
Elapsed time for Section 4 = 16.94922
Elapsed time for Section 5 = 1.414063
Elapsed time for Section 6 = 0.1054688
Elapsed time for Section 7 = 0.1679688
Elapsed time for Section 8 = 6.640625E-02
Elapsed time for Section 5 = 2.808594
 
Upvote 0
Glad we could help & thanks for the feedback.
I think it will be difficult to make any more significant gains, without pulling the whole thing into an array & processing that.
 
Upvote 0

Forum statistics

Threads
1,223,532
Messages
6,172,875
Members
452,486
Latest member
standw01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top