What is wrong with this macro?

tobyz95 0 Reputation points
2023-03-23T21:32:41.3733333+00:00

Hello All, Using Office16. I have been using this macro for many years, and suddenly it is giving me a runtime error 13 mismatch. I have not changed anything on my spreadsheet, or in the macro before it stopped working. Any help would be greatly appreciated. Thanks.


Sub ACCU_Pay_By_Date_1()

Dim oRng    As Range
Dim i       As Long
Dim dblRes  As Double

Set oRng = Range("E2:E69")
For i = 1 To oRng.Cells.Count
    If oRng(i).Font.ColorIndex = 15 And CDbl(oRng(i).Offset(0, -1)) <= CDbl(Range("D96")) Then
        If InStr(oRng(i).Offset(0, 1), ChrW(8730)) = 0 Then
            dblRes = dblRes + oRng(i)
        End If
    End If
Next i
Application.EnableEvents = False
Range("D92") = dblRes
Application.EnableEvents = True

End Sub
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,839 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,858 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.