arbrandt / OPGEE

Oil Production Greenhouse Gas Emissions Estimator
18 stars 3 forks source link

VBA error for fixing gas composition if the summation is not 100 % #491

Open wennanlong opened 1 year ago

wennanlong commented 1 year ago

Reference can be zero. Please add an if statement for reference = 0 to cover the divide by zero cases.

       For R = 0 To 6
            If Results.Range("G36").Offset(R, i).Interior.Color = RGB(0, 155, 118) Then
                If Reference = 0 Then
                    Results.Range("G36").Offset(R, i).Value = 0
                Else
                    Results.Range("G36").Offset(R, i).Value = Results.Range("G36").Offset(R, i).Value / Reference
                End If
            End If
        Next R