Option Compare Text
Sub ProblemLog()
With Application
.DisplayAlerts = False
.ScreenUpdating = False
.EnableEvents = False
End With
Dim data, result, rng2color As Range, rcount As Long, colcount As Long, j As Long, i As Long, myval, errstr As String
Const temp = "#%$#"
If ActiveSheet.Name = "Claims Data" Or ActiveSheet.Name = "Template" Then
data = Range("A1", Cells(Rows.Count, 1).End(xlUp)).Resize(, 46)
rcount = UBound(data)
colcount = UBound(data, 2)
ReDim result(1 To rcount, 1 To colcount + 1)
result(1, 1) = "Provider"
result(1, 2) = "Box Number"
result(1, 3) = "Claim Number"
result(1, 4) = "Treatment Date"
result(1, 5) = "Discharge Date"
result(1, 6) = "Benefit Type"
result(1, 7) = "Member PIN"
result(1, 8) = "Member Name"
result(1, 9) = "Member Class"
result(1, 10) = "Policy Number"
result(1, 11) = "Policy Holder Name"
result(1, 12) = "Policy Benefit"
result(1, 13) = "Network Type"
result(1, 14) = "Policy Type"
result(1, 15) = "Diagnosis"
result(1, 16) = "Gross"
result(1, 17) = "Discount"
result(1, 18) = "Deductible"
result(1, 19) = "Rejected Amount"
result(1, 20) = "Approved Amount"
result(1, 21) = "Total difference"
result(1, 22) = "Created By "
result(1, 23) = "Created Date"
result(1, 24) = "Created Time"
result(1, 25) = "Pre-Auth Limit"
result(1, 26) = "Approval Number"
result(1, 27) = "Approval Date"
result(1, 28) = "Auditor"
result(1, 29) = "Difference Reason"
result(1, 30) = "Description"
result(1, 31) = "Claim Caution"
result(1, 32) = "Marital Status"
result(1, 33) = "Gender"
result(1, 34) = "Insured Type"
result(1, 35) = "Age"
result(1, 36) = "Chronic"
result(1, 37) = "Pre Existing"
result(1, 38) = "Fraud"
result(1, 39) = "Emergency"
result(1, 40) = "Follow Up"
result(1, 41) = "File Number"
result(1, 42) = "Notes"
result(1, 43) = "Claim Status"
result(1, 44) = "Recovery Amount"
result(1, 45) = "Approved VAT Amount"
result(1, 46) = "Rejected VAT Amount"
result(1, 47) = "Remarks"
j = 1
For i = 2 To rcount
j = j + 1
myval = data(i, 15)
If Not myval Like "Z00*" Then
Else
errstr = "Error 1"
result(j, 15) = temp
End If
myval = data(i, 15)
If Not myval Like "J03*" Then
'If Not myval Like "J03*" Then
Else
If errstr = "" Then errstr = "Error 2" Else errstr = errstr & ", " & "Error 2"
result(j, 15) = temp
End If
If errstr <> "" Then
For n = 1 To colcount
result(j, n) = result(j, n) & data(i, n)
Next
result(j, 47) = errstr
errstr = ""
Else: j = j - 1
End If
Next
Application.ScreenUpdating = 0
Application.ReplaceFormat.Interior.ColorIndex = 6
'*******************************************************************************************************************************************************************
Sheets.Add(Before:=Sheets("Claims Data")).Name = "ErrorLog"
With Worksheets("ErrorLog")
.Range("a1").Resize(j, colcount + 1) = result
With .Range("a1").Resize(, colcount + 1)
.Interior.ColorIndex = 55
.Font.ColorIndex = 2
.Font.Bold = 1
.HorizontalAlignment = xlCenter
End With
With .UsedRange
.Font.Name = "Calibri"
.Font.Size = 9
.Borders.LineStyle = xlContinuous
.Offset(, 1).Resize(, 47).Replace what:=temp, replacement:="", lookat:=xlPart, ReplaceFormat:=True
.Offset(, 1).Resize(, 47).Replace what:=temp, replacement:="", lookat:=xlPart
End With
End With
Else
Response = MsgBox("This option will not for sheet: " & UCase(ActiveSheet.Name) & vbCrLf + "Please select/active below worksheets to use this option." _
+ vbCrLf + " " + vbCrLf + "1. DATA Worksheet" + vbCrLf + "2. TEMPLATE Worksheet" + vbCrLf + " " + vbCrLf + " Abdul Aleem - Lets Make Life Easier...", vbOKOnly + vbInformation, "Underwriting Department")
End If
'*******************************************************************************************************************************************************************
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Bookmarks