(Solved) – VBA is causing Overflow when assigning cell value

  • by
(solved)-–-vba-is-causing-overflow-when-assigning-cell-value

I have the following VBA code:

Dim row_to_update As Long
Dim new_finish_date As Date
If Not Intersect(Target, Range("J:J")) Is Nothing Then
        Debug.Print "Dependency:" & dependency_to_find
        Set f_dependency = Range("I:I").Find(dependency_to_find, LookIn:=xlValues, lookat:=xlWhole)
        If Not f_dependency Is Nothing Then
            new_finish_date = Range("K" & changed_row_update).Value
            firstAddress = f_dependency.Address
            Do
                Set f_dependency = Range("I:I").FindNext(f_dependency)
                row_to_update = f_dependency.Row
                Debug.Print "The row to update is: " & row_to_update
                Debug.Print "The new finish date is: " & new_finish_date
                'Range("J" & row_to_update).Value = WorksheetFunction.WorkDay(new_finish_date, 1)
            Loop While Not f_dependency Is Nothing And f_dependency.Address <> firstAddress
        End If
    End If

For some reason this line is causing me an overflow error:

Debug.Print "The new finish date is: " & new_finish_date

Leave a Reply

Your email address will not be published. Required fields are marked *