arbrandt / OPGEE

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

Flaring Smart Default Issue #487

Open wennanlong opened 1 year ago

wennanlong commented 1 year ago

In the 'Activate Field' sheet, the default value (Cell K125) for FOR refers to the 'Flaring' sheet (Cell M49). Then in the VBA, the flaring sheet needs to be recalculated.

Replace the following lines of code in VBA BulkAssessment

'If cell in inputs sheet does not have data, go to the active field uncertainty draw
        For j = LBound(RowsToProcess) To UBound(RowsToProcess)
            RowBeingProcessed = RowsToProcess(j)

            If IsEmpty(Worksheets("Inputs").Cells(RowBeingProcessed, i + 7).Value) Then
                    'Calculate Flaring sheet
                    If RowBeingProcessed = 86 Then
                        Sheets("Flaring").Calculate
                    End If

                'Calculate this sheet only to update smart defaults in this population process.
                ActiveField.Calculate

                'User value in the "Active Field Working Sheet" is equal to default value in the "Active Field Working Sheet"
                ActiveField.Cells(RowBeingProcessed + 39, 10).Value2 = ActiveField.Cells(RowBeingProcessed + 39, 13).Value2

                'Blank entry in "Results" sheet is equal to User value in the "Active Field Working Sheet"
                Results.Cells(RowBeingProcessed, i + 7).Value2 = ActiveField.Cells(RowBeingProcessed + 39, 10).Value2
                'Color the parameter cell in the Results sheet as default
                Results.Cells(RowBeingProcessed, i + 7).Interior.Color = RGB(0, 155, 118)
            End If
        Next j