Hi Guys,
I have selected DIm Ingrows As Long and set it up as Range ("C2:C" & lngrows & ",D2:D" & lngrows & ",E2:E" & lngrows & ",F2:F" & lngrows & ",G2:G" & lngrows & ",H2:H" & lngrows & ",I2:I" & Ingrows & ",J2:J").Select Selection.Copy
some how it does not work most probably i am selecting something wrong or missed
Do you have any idea how to finish this ?
Many Thanks
I have selected DIm Ingrows As Long and set it up as Range ("C2:C" & lngrows & ",D2:D" & lngrows & ",E2:E" & lngrows & ",F2:F" & lngrows & ",G2:G" & lngrows & ",H2:H" & lngrows & ",I2:I" & Ingrows & ",J2:J").Select Selection.Copy
some how it does not work most probably i am selecting something wrong or missed
Do you have any idea how to finish this ?
Code:
Sub GetFilterForFails12()
'
' GetFilterForFails Macro
'
'
Dim CurrentYear As Integer
Dim Previousweek As Integer
Dim slaUK As String
Dim lFails As Long
Dim Ingrows As Long
CurrentYear = DatePart("yyyy", Date)
Previousweek = DatePart("ww", Date) - 1
slaUK = "SLA builder UK.xlsm"
Sheets("SLA - Order delivery").Select
Selection.AutoFilter
ActiveSheet.ListObjects("tbl_SLA_OrderDelivery").Range.AutoFilter Field:=30, _
Criteria1:=CurrentYear
ActiveSheet.ListObjects("tbl_SLA_OrderDelivery").Range.AutoFilter Field:=29, _
Criteria1:=Previousweek
ActiveSheet.ListObjects("tbl_SLA_OrderDelivery").Range.AutoFilter Field:=28, _
Criteria1:="Fail"
Range("C2:C" & lngrows & ",D2:D" & lngrows & ",E2:E" & lngrows & ",F2:F" & lngrows & ",G2:G" & lngrows & ",H2:H" & lngrows & ",I2:I" & Ingrows & ",J2:J").Select
Selection.Copy
Windows("SLA mitigation template v2.xlsx").Activate
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("SLA builder UK.xlsm").Activate
On Error Resume Next
lFails = ActiveSheet.ListObjects("tbl_SLA_OrderDelivery").DataBodyRange.SpecialCells(xlCellTypeVisible).Rows.Count
On Error GoTo 0
If lFails = 0 Then MsgBox "Keep Calm and There were no FAILS this week :)"
End Sub
Many Thanks
Last edited by a moderator: