Originally Posted by
mercmannick
oops sorry forgot to zip
How about this. Not quite the same numbers as you, but I am testing 1 day later.
Sub ToughMacroa()
' Procedure : ToughMacro
' DateTime : 7/8/2005 13:11
' Author : MR Excel
Application.ScreenUpdating = False
Dim iRow As Long
Dim iLastRow As Long
Dim iSheetCount As Long
Dim iCountCurrentWeek As Long
Dim iCount1to2Week As Long
Dim iCount2to3Week As Long
Dim iCount3toAll As Long
Dim cNotIncluded As Long
Dim cDeleted As Long
Dim rngToSort As Range
iLastRow = Range("B8").End(xlDown).Row
For iRow = iLastRow To 8 Step -1
If Cells(iRow, Asc("O") - 64).Value = "CNF" Or _
Cells(iRow, "B").Value Like "55*" Then
Rows(iRow).Delete
cDeleted = cDeleted + 1
Else
With Cells(iRow, "E")
.Value = DateValue(Replace(.Value, ".", "/"))
If .Value < Date And .Value >= (Date - 7) Then
iCountCurrentWeek = iCountCurrentWeek + 1
.Offset(0, -4).Value = 1
ElseIf .Value <= (Date - 8) And .Value >= Date - 14 Then
.Offset(0, -4).Value = 2
iCount1to2Week = iCount1to2Week + 1
ElseIf .Value <= (Date - 15) And .Value >= Date - 21 Then
.Offset(0, -4).Value = 3
iCount2to3Week = iCount2to3Week + 1
ElseIf .Value <= (Date - 22) Then
iCount3toAll = iCount3toAll + 1
.Offset(0, -4).Value = 4
Else
cNotIncluded = cNotIncluded + 1
End If
End With
End If
Next iRow
With Range("A1:B5")
.Interior.ColorIndex = 38
.Font.Bold = True
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
Columns("A:A").ColumnWidth = 22.71
End With
End With
Range("A1").Value = "Late 1 Week :": Range("B1").Value = iCountCurrentWeek
Range("A2").Value = "Late 2 Weeks :": Range("B2").Value = iCount1to2Week
Range("A3").Value = "Late 3 Weeks : ": Range("B3").Value = iCount2to3Week
Range("A4").Value = "Late 4 Weeks :": Range("B4").Value = iCount3toAll
Range("A5").Value = "CNF & 55 Deleted :": Range("B5").Value = cDeleted
Application.ScreenUpdating = True
End Sub