Sub RunReport()
Application.ScreenUpdating = False
Dim LastRowAGG As Long
Dim LastRowACQ As Long
Dim RowNum As Long
Dim LastRowRpt As Long
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
cnReport.Activate
Range("A2:G" & LastRowRpt&).Select
Selection.ClearContents
cnAggregated.Activate
LastRowAGG = cnAggregated.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim PONum As String
Dim Requestor As String
Dim System As Long
Dim Receipt As Long
Dim Vendor As String
Dim DtRcvEntNBS As Date
Dim DtRcptGoodsSvsNBS As Date
Dim DtInvNBS As Date
Dim ICIS As String
Dim ICISEmailSent As String
Dim DtICISEmailReq As Date
Dim ActualDtRecptFmReq As Date
Dim DtReqRespondICIS As Date
Dim SufficientResp As String
Dim DtEmailReqGlobRecToEnterRec As Date
Dim ProofRecptFmReq As String
Dim LineItemsEntRec As String
Dim LineAmount As String
Dim FullPartRec As String
Dim PriorPdRec As String
Dim ActualRecDateLB27 As Date
Dim DtEmailICISIndRecGlobRec As Date
Dim ConfEmail As String
Dim SubstDocs As String
Dim EmailtoGR As String
Dim LB27Complete As String
Dim EmailComplete As String
Dim Notes As String
Dim Receiver As String
For RowNum = 5 To LastRowAGG
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
PONum = cnAggregated.Cells(RowNum, 1)
Requestor = cnAggregated.Cells(RowNum, 2)
System = cnAggregated.Cells(RowNum, 3)
Receipt = cnAggregated.Cells(RowNum, 4)
Vendor = cnAggregated.Cells(RowNum, 5)
DtRcvEntNBS = cnAggregated.Cells(RowNum, 6)
DtRcptGoodsSvsNBS = cnAggregated.Cells(RowNum, 7)
DtInvNBS = cnAggregated.Cells(RowNum, 8)
ICIS = cnAggregated.Cells(RowNum, 9)
ICISEmailSent = cnAggregated.Cells(RowNum, 10)
DtICISEmailReq = cnAggregated.Cells(RowNum, 11)
ActualDtRecptFmReq = cnAggregated.Cells(RowNum, 12)
DtReqRespondICIS = cnAggregated.Cells(RowNum, 13)
SufficientResp = cnAggregated.Cells(RowNum, 14)
DtEmailReqGlobRecToEnterRec = cnAggregated.Cells(RowNum, 15)
ProofRecptFmReq = cnAggregated.Cells(RowNum, 16)
LineItemsEntRec = cnAggregated.Cells(RowNum, 17)
LineAmount = cnAggregated.Cells(RowNum, 18)
FullPartRec = cnAggregated.Cells(RowNum, 19)
PriorPdRec = cnAggregated.Cells(RowNum, 20)
ActualRecDateLB27 = cnAggregated.Cells(RowNum, 21)
DtEmailICISIndRecGlobRec = cnAggregated.Cells(RowNum, 22)
ConfEmail = cnAggregated.Cells(RowNum, 23)
SubstDocs = cnAggregated.Cells(RowNum, 24)
EmailtoGR = cnAggregated.Cells(RowNum, 25)
LB27Complete = cnAggregated.Cells(RowNum, 26)
EmailComplete = cnAggregated.Cells(RowNum, 27)
Notes = cnAggregated.Cells(RowNum, 28)
Receiver = cnAggregated.Cells(RowNum, 29)
If ICISEmailSent = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = System
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing ICIS Email to Requestor/End User"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If SufficientResp = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Insufficient Proof of Receipt"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If ProofRecptFmReq = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "No Proof of Receipt of Goods/Service from Requestor"
cnReport.Cells(LastRowRpt, 7).Value = "Global Receiver"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If LineItemsEntRec = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Line Item Information"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If LineAmount = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Line Item Amounts"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If FullPartRec = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Indication of Full/Partial Receiving"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If PriorPdRec = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Indication of Prior Year Receiving"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If ConfEmail = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Confirmation Email from Requestor"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If SubstDocs = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Substantiating Document for Receipt of Goods/Services"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If EmailtoGR = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Email to Global Receiver to Enter Receiving"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If LB27Complete = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Incomplete LB27"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If EmailComplete = "No" Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Missing Email to ICIS of Completed Receiving"
cnReport.Cells(LastRowRpt, 7) = "ICIS"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If cnAggregated.Cells(RowNum, 7).Value <> cnAggregated.Cells(RowNum, 12).Value Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "Date of Recpt in NBS Doesn't Match Actual Date of Recpt of Goods/Svs"
cnReport.Cells(LastRowRpt, 7) = "Receiver"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If cnAggregated.Cells(RowNum, 15).Value <> cnAggregated.Cells(RowNum, 22).Value And cnAggregated.Cells(RowNum, 15).Value < cnAggregated.Cells(RowNum, 22).Value And (cnAggregated.Cells(RowNum, 22).Value - cnAggregated.Cells(RowNum, 15).Value) > 1 Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "ICIS Email to GR / GS Response Timeliness"
cnReport.Cells(LastRowRpt, 7) = "Receiver"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If cnAggregated.Cells(RowNum, 15).Value <> cnAggregated.Cells(RowNum, 22).Value And cnAggregated.Cells(RowNum, 15).Value > cnAggregated.Cells(RowNum, 22).Value And (cnAggregated.Cells(RowNum, 15).Value - cnAggregated.Cells(RowNum, 22).Value) > 1 Then
cnReport.Cells(LastRowRpt, 1).Value = Receiver
cnReport.Cells(LastRowRpt, 2).Value = Requestor
cnReport.Cells(LastRowRpt, 3).Value = SYSTEM
cnReport.Cells(LastRowRpt, 4).Value = Receipt
cnReport.Cells(LastRowRpt, 5).Value = Vendor
cnReport.Cells(LastRowRpt, 6) = "ICIS Email to GR / GS Response Timeliness"
cnReport.Cells(LastRowRpt, 7) = "Receiver"
Else
End If
LastRowRpt = cnReport.Cells.Find("*", After:=Range(Cells(Rows.Count, Columns.Count), Cells(Rows.Count, Columns.Count)), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
Next RowNum