Hi,
Im kinda new with excel and i need help with the error im encountering. I intend to use the code as a counter with 2 conditions one for the date and the second for the case indicated. Im getting the run time error 91 object variable or with block variable not set
Private Sub GetData_Click()
Dim i As Integer
i = 6
Range("C6:C11") = 0
Do While Range("D" & i) <> ""
j = 8
DataFound = False
EfficiencyFraud = 0
AccountSpecificViolation = 0
PrivacyPolicyViolation = 0
FinancialFraud = 0
OtherCompanyViolation = 0
CSATFraud = 0
Do While Worksheets("Tracker").Range("A" & j) <> ""
If Worksheets("Tracker").Range("G" & j) = Program And Worksheets("Tracker").Range("B" & j) >= DateStart And Worksheets("Tracker").Range("B" & j) <= DateEnd Then
DataFound = True
Select Case Worksheets("Tracker").Range("P" & j).Value
Case "Efficiency Fraud"
EfficiencyFraud = EfficiencyFraud + 1
Case "Account Specific Violation"
AccountSpecificViolation = AccountSpecificViolation + 1
Case "Privacy Policy Violation"
PrivacyPolicyViolation = PrivacyPolicyViolation + 1
Case "Financial Fraud"
FinancialFraud = FinancialFraud + 1
Case "Other Company Violation"
OtherCompanyViolation = OtherCompanyViolation + 1
Case "CSAT Fraud"
CSATFraud = CSATFraud + 1
End Select
End If
j = j + 1
Loop
If DataFound = True Then
Range("C6") = EfficiencyFraud
Range("C7") = AccountSpecificViolation
Range("C8") = PrivacyPolicyViolation
Range("C9") = FinancialFraud
Range("C10") = OtherCompanyViolation
Range("C11") = CSATFraud
Else
Range("C6") = "N/A"
Range("C7") = "N/A"
Range("C8") = "N/A"
Range("C9") = "N/A"
Range("C10") = "N/A"
Range("C11") = "N/A"
End If
i = i + 1
Loop
End Sub
Bookmarks