Dim flip As Boolean
Dim filledin As Boolean
Dim startup As Boolean
Private Sub ClearEntrys()
    For Each page In Me.mpgeMain.Pages
        For Each ctrl In page.Controls
            If TypeName(ctrl) = "TextBox" Then
                ctrl.Value = ""
            End If
        Next ctrl
    Next page
End Sub
Private Sub LoadFromDataEntry()
    Sheets("Data Entry").Select
    txtVehiclesRecycled = Cells(43, "ad") * 100
    txtAlWCon = Cells(12, "ad") * 100
    txtAlWoCon = Cells(13, "ad") * 100
    txtAlExtrude = Cells(14, "ad") * 100
    txtAlForgings = Cells(15, "ad") * 100
    txtStForgings = Cells(15, "ai") * 100
    txtAlCastings = Cells(16, "ad") * 100
    txtStCastings = Cells(16, "ai") * 100
    txtUnFlSt = Cells(17, "ai") * 100
    txtHDSt = Cells(18, "ai") * 100
    txtLSSt = Cells(19, "ai") * 100
    txtHDGLSSt = Cells(20, "ai") * 100
    txtIndirectMassSavings = Cells(21, "ad") * 100
    txtAlRolled = Cells(25, "ad") * 100
    txtStRolled = Cells(25, "ai") * 100
    txtAlExtruded = Cells(26, "ad") * 100
    txtAlForgingsScrap = Cells(27, "ad") * 100
    txtStForgingsScrap = Cells(27, "ai") * 100
    txtAlCastingsScrap = Cells(28, "ad") * 100
    txtStCastingsScrap = Cells(28, "ai") * 100
    txtBiofuel = Cells(34, "ad") * 100
    txtAirFriction = Cells(38, "ad") * 100
    txtAlDismantled = Cells(46, "ad") * 100
    txtStDismantled = Cells(46, "ai") * 100
    txtAlShredded = Cells(47, "ad") * 100
    txtStShredded = Cells(47, "ai") * 100
    txtAlEm = Cells(48, "ad") * 100
    txtLAlDismantled = Cells(50, "ad") * 100
    txtLStDismantled = Cells(50, "ai") * 100
    txtLAlShredding = Cells(51, "ad") * 100
    txtLStShredding = Cells(51, "ai") * 100
    txtAlEMSorting = Cells(52, "ad") * 100
    txtAlCarShred = Cells(53, "ad") * 100
    txtStCarShred = Cells(53, "ai") * 100
    txtAlSinkFloat = Cells(54, "ad") * 100
    txtAlEAF = Cells(55, "ad") * 100
    txtStEAF = Cells(55, "ai") * 100
    txtAlEAFCorrection = Cells(56, "ad") * 100
    txtStEAFCorrection = Cells(56, "ai") * 100
    txtALRecoveredScrap = Cells(57, "ad") * 100
    txtComponent = Cells(5, "ad")
    txtMass = Cells(7, "ad")
    txtLitresGas = Cells(32, "ad")
    txtLitresDiesel = Cells(33, "ad")
    txtLpg = Cells(35, "ad")
    txtMJEnergy = Cells(36, "ad")
    cmbGrid = Cells(37, "ad")
    txtNumPerSeries = Cells(8, "ad")
    txtComponentMassAl = Cells(10, "ad")
    txtComponentMassSt = Cells(10, "ai")
    txtLifeTimeDistance = Cells(39, "ad")
End Sub
Private Sub CheckForEmptys(page)
    For Each ctrl In Me.mpgeMain.Pages(page).Controls
        If TypeName(ctrl) = "TextBox" Then
            If ctrl.Text = "" Then
                'filledin = False

            ElseIf IsNumeric(ctrl.Text) Then
                Select Case ctrl.Name
                    Case "txtMass", "txtNumPerSeries", "txtComponentMassAl", "txtComponentMassSt", "txtLitresDiesel", "txtLitresGas", "txtLpg", "txtMJEnergy", "txtLifeTimeDistance"
                    Case Else
                        'ctrl.Text = ctrl.Text / 100

                End Select
            End If
    End If
    Next ctrl
End Sub
Private Sub updateRecyclingRate()
    If Not startup Then
        Sheets("Data Entry").Select
        UpdateStage4
        Worksheets("Calculations-EoL&substitution").Visible = True
        Sheets("Calculations-EoL&substitution").Select
        rateAl = Cells(96, "X")
        rateST = Cells(96, "AA")
        If Not IsError(rateAl) Then lblRecyclingRateAl = CStr(Format(rateAl * 100, "#,##0") & "%")
        If Not IsError(rateST) Then lblRecyclingRateSt = CStr(Format(rateST * 100, "#,##0") & "%")
        Worksheets("Calculations-EoL&substitution").Visible = False
    End If
End Sub
Private Sub updateCell(X, Y, val)
    If IsNumeric(val) Then
        Cells(X, Y) = CDbl(val)
    ElseIf (val <> "") Then
        Cells(X, Y) = val
    Else
        Cells(X, Y) = 1
    End If
End Sub
Private Sub updateResultsCode(X)
    With Sheets("Results").Range(X)
        frmCode.Controls("txt" & X).BackColor = .Interior.Color
    End With
End Sub
Private Sub updateResultsInfo(X)
    With Sheets("Results").Range(X)
        If X = "AB10" Then
            If (IsNumeric(.Value)) Then frmInfo.Controls("txt" & X).Text = CStr(Format(.Value * 100, "#,##0") & "%")
        ElseIf X = "AB5" Then
            frmInfo.Controls("txt" & X).Text = CStr(.Value)
        Else
            If (IsNumeric(.Value)) Then frmInfo.Controls("txt" & X).Text = CStr(Format(.Value, "#,##0.00"))
        End If
        frmInfo.Controls("txt" & X).BackColor = .Interior.Color
    End With
End Sub
Private Sub updateResultsLoads(X)
    With Sheets("Results").Range(X)
        If (IsNumeric(.Value)) Then frmLoads.Controls("txt" & X).Text = CStr(Format(.Value, "#,##0"))
        frmLoads.Controls("txt" & X).BackColor = .Interior.Color
    End With
End Sub
Private Sub updateResultsGHGSavings(X)
    With Sheets("Results").Range(X)
        If (IsNumeric(.Value)) Then frmGHGSavings.Controls("txt" & X).Text = CStr(Format(.Value, "#,##0"))
        frmGHGSavings.Controls("txt" & X).BackColor = .Interior.Color
    End With
End Sub
Private Sub updateResultsCarbonFootprint(X)
    With Sheets("Results").Range(X)
        If (IsNumeric(.Value)) Then frmCarbonFootprint.Controls("txt" & X).Text = CStr(Format(.Value, "#,##0"))
        frmCarbonFootprint.Controls("txt" & X).BackColor = .Interior.Color
    End With
End Sub
Private Sub updateResultsRecyclingRate(X)
    With Sheets("Results").Range(X)
        If X = "AB47" Or X = "AB49" Or X = "AE47" Or X = "AE49" Then
            If (IsNumeric(.Value)) Then frmRecyclingRate.Controls("txt" & X).Text = CStr(Format(.Value * 100, "#,##0") & "%")
        Else
            If (IsNumeric(.Value)) Then frmRecyclingRate.Controls("txt" & X).Text = CStr(Format(.Value, "Standard"))
        End If
        'If (IsNumeric(.Value)) Then frmRecyclingRate.Controls("txt" & x).Text = CStr(Format(.Value, "Standard"))

        frmRecyclingRate.Controls("txt" & X).BackColor = .Interior.Color
    End With
End Sub
Private Sub btnAnalysis_Click()
    mpgeMain.Value = 5
    lblStage = ""
    lblTitle = "Sensitivity Analysis"
End Sub

Private Sub btnClearStartup_Click()
    Dim msg As String
    Dim ans As Integer
    msg = "Do you really want to clear the entrys?"
    ans = MsgBox(msg, vbQuestion + vbYesNo, "Transport Model Data Entry")
    If ans = vbYes Then
        Call ClearEntrys
    End If
End Sub

Private Sub btnDoAnalysis_Click()
    mpgeAnalysis.Value = 1
End Sub
Private Sub btnPrint_Click()
    Sheets("Results").Select
    Application.Dialogs(xlDialogPrint).Show
End Sub
Private Sub btnRestart_Click()
    Dim msg As String
    Dim ans As Integer
    msg = "Restart data entry?"
    ans = MsgBox(msg, vbQuestion + vbYesNo, "Transport Model Data Entry")
    If ans = vbYes Then
        lblStage = "Stage 1. Specification of the vehicle and the component"
        btnRestart.Visible = False
        btnPrint.Visible = False
        btnSave.Visible = False
        btnResults.Enabled = False
        btnDataSources.Enabled = False
        btnCalculations.Enabled = False
        lblHelp.Visible = True
        mpgeMain.Value = 0
        UpdateControls
    End If
End Sub
Private Sub btnSave_Click()
    Application.Dialogs(xlDialogSaveAs).Show
End Sub

Private Sub lblOWClink_Click()
    owcaddress = "http://www.microsoft.com/downloads/details.aspx?FamilyId=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en"
    ActiveWorkbook.FollowHyperlink owcaddress
End Sub

Private Sub lblRecyclingRateAl_Click()

End Sub

Private Sub txtAirFriction_Enter()
    updateHelp (38)
End Sub
Private Sub txtAlCarShred_Enter()
    'updateHelp (50)

End Sub
Private Sub txtAlCastings_Enter()
    updateHelp (16)
End Sub
Private Sub txtAlCastingsScrap_Enter()
    updateHelp (28)
End Sub
Private Sub txtAlDismantled_Enter()
    updateHelp (46)
End Sub
Private Sub txtAlEAF_Enter()
    updateHelp (52)
End Sub
Private Sub txtAlEAFCorrection_Enter()
    updateHelp (56)
End Sub
Private Sub txtAlEMSorting_Enter()
    'updateHelp (49)

End Sub
Private Sub txtAlExtrude_Enter()
    updateHelp (14)
End Sub
Private Sub txtAlExtruded_Enter()
    updateHelp (26)
End Sub
Private Sub txtAlForgings_Enter()
    updateHelp (15)
End Sub
Private Sub txtAlForgingsScrap_Enter()
    updateHelp (27)
End Sub
Private Sub txtALRecoveredScrap_Enter()
    updateHelp (57)
End Sub
Private Sub txtALEm_Enter()
    updateHelp (48)
End Sub
Private Sub updateHelp(rowRef)
    If flip Then
        flip = False
        lblHelp.ForeColor = RGB(180, 0, 0)
    Else
        flip = True
        lblHelp.ForeColor = RGB(0, 0, 238)
    End If
    Sheets("Data entry").Select
    If Mid(rowRef, 1, 2) = "BO" Then
        strow = CInt(Mid(rowRef, 3, 2))
        lblHelp = Cells(strow, "BO")
    Else
        lblHelp = Cells(rowRef, "AO")
    End If
End Sub
Private Sub txtAlRolled_Enter()
    updateHelp (25)
End Sub
Private Sub txtAlSinkFloat_Enter()
    'updateHelp (51)

End Sub
Private Sub txtAlWCon_Enter()
    updateHelp (13)
End Sub
Private Sub txtAlWoCon_Enter()
    updateHelp (12)
End Sub
Private Sub txtBiofuel_Enter()
    updateHelp (34)
End Sub
Private Sub txtComponent_Enter()
    updateHelp (5)
End Sub
Private Sub txtComponentMassAl_Enter()
    updateHelp (10)
End Sub
Private Sub txtComponentMassSt_Enter()
    updateHelp ("BO10")
End Sub
Private Sub txtHDGLSSt_Enter()
    updateHelp (20)
End Sub
Private Sub txtHDSt_Enter()
    updateHelp (18)
End Sub
Private Sub txtIndirectMassSavings_Enter()
    updateHelp (21)
End Sub
Private Sub txtLAlDismantled_Enter()
    'updateHelp (50)

End Sub
Private Sub txtLAlShredding_Enter()
    'updateHelp (51)

End Sub
Private Sub txtLifeTimeDistance_Enter()
    updateHelp (39)
End Sub
Private Sub txtLitresDiesel_Enter()
    updateHelp (33)
End Sub
Private Sub txtLitresGas_Enter()
    updateHelp (32)
End Sub
Private Sub txtLpg_Enter()
    updateHelp (35)
End Sub
Private Sub txtLSSt_Enter()
    updateHelp (19)
End Sub
Private Sub txtMass_Enter()
    updateHelp (7)
End Sub

Private Sub txtStEAFCorrection_Enter()
    updateHelp (56)
End Sub

Private Sub txtVehiclesRecycled_Enter()
    updateHelp (43)
End Sub
Private Sub txtMJEnergy_Enter()
    updateHelp (36)
End Sub
Private Sub txtNumPerSeries_Enter()
    updateHelp (8)
End Sub
Private Sub txtStDismantled_Enter()
    updateRecyclingRate
End Sub
Private Sub txtAlShredded_Enter()
    updateHelp (47)
    updateRecyclingRate
End Sub
Private Sub txtStShredded_Change()
    updateRecyclingRate
End Sub
Private Sub txtStEAFCorrection_Change()
    updateRecyclingRate
End Sub
Private Sub txtAlEAFCorrection_Change()
    updateRecyclingRate
End Sub
Private Sub txtLAlDismantled_Change()
    updateRecyclingRate
End Sub
Private Sub txtLStDismantled_Change()
    updateRecyclingRate
End Sub
Private Sub txtLAlShredding_Change()
    updateRecyclingRate
End Sub
Private Sub txtLStShredding_Change()
    updateRecyclingRate
End Sub
Private Sub txtAlEMSorting_Change()
    updateRecyclingRate
End Sub
Private Sub txtAlCarShred_Change()
    updateRecyclingRate
End Sub
Private Sub txtStCarShred_Change()
    updateRecyclingRate
End Sub
Private Sub txtAlSinkFloat_Change()
    updateRecyclingRate
End Sub
Private Sub txtAlEAF_Change()
   updateRecyclingRate
End Sub
Private Sub txtVehiclesRecycled_Change()
   updateRecyclingRate
End Sub
Private Sub txtStEAF_Change()
    updateRecyclingRate
End Sub
Private Sub txtALRecoveredScrap__Change()
    updateRecyclingRate
End Sub
Sub UpdateControls()
    Select Case mpgeMain.Value
        Case 0
            btnPrevious.Enabled = False
            btnNext.Enabled = True
            lblStage = "Stage 1. Specification of the vehicle and the component"
        Case 1
            lblStage = "Stage 2. Production stage"
            btnPrevious.Enabled = True
            btnNext.Enabled = True
            btnFinish.Enabled = False
        Case 2
            btnPrevious.Enabled = True
            btnNext.Enabled = True
            btnFinish.Enabled = False
            lblStage = "Stage 3. Use stage"
        Case 3
            btnPrevious.Enabled = True
            btnNext.Enabled = False
            btnFinish.Enabled = True
            lblStage = "Stage 4. End of Life stage"
        Case Else
            btnPrevious.Enabled = True
            btnNext.Enabled = True
            btnFinish.Enabled = False
        End Select
End Sub
Sub UpdateStage1()
    Sheets("Data Entry").Select
    Call CheckForEmptys(0)
    If filledin Then
        Call updateCell(5, "ad", txtComponent)
        Call updateCell(7, "ad", txtMass)
        Call updateCell(8, "ad", txtNumPerSeries)
        Call updateCell(10, "ad", txtComponentMassAl)
        Call updateCell(10, "ai", txtComponentMassSt)
        If IsNumeric(txtAlWCon) Then Call updateCell(12, "ad", txtAlWCon / 100)
        If IsNumeric(txtAlWoCon) Then Call updateCell(13, "ad", txtAlWoCon / 100)
        If IsNumeric(txtAlExtrude) Then Call updateCell(14, "ad", txtAlExtrude / 100)
        If IsNumeric(txtAlForgings) Then Call updateCell(15, "ad", txtAlForgings / 100)
        If IsNumeric(txtStForgings) Then Call updateCell(15, "ai", txtStForgings / 100)
        If IsNumeric(txtAlCastings) Then Call updateCell(16, "ad", txtAlCastings / 100)
        If IsNumeric(txtStCastings) Then Call updateCell(16, "ai", txtStCastings / 100)
        If IsNumeric(txtUnFlSt) Then Call updateCell(17, "ai", txtUnFlSt / 100)
        If IsNumeric(txtHDSt) Then Call updateCell(18, "ai", txtHDSt / 100)
        If IsNumeric(txtLSSt) Then Call updateCell(19, "ai", txtLSSt / 100)
        If IsNumeric(txtHDGLSSt) Then Call updateCell(20, "ai", txtHDGLSSt / 100)
        If IsNumeric(txtIndirectMassSavings) Then Call updateCell(21, "ad", txtIndirectMassSavings / 100)
    End If
End Sub
Sub UpdateStage2()
    Sheets("Data Entry").Select
    Call CheckForEmptys(1)
    If filledin Then
        If IsNumeric(txtAlRolled) Then Call updateCell(25, "ad", txtAlRolled / 100)
        If IsNumeric(txtStRolled) Then Call updateCell(25, "ai", txtStRolled / 100)
        If IsNumeric(txtAlExtruded) Then Call updateCell(26, "ad", txtAlExtruded / 100)
        If IsNumeric(txtAlForgingsScrap) Then Call updateCell(27, "ad", txtAlForgingsScrap / 100)
        If IsNumeric(txtStForgingsScrap) Then Call updateCell(27, "ai", txtStForgingsScrap / 100)
        If IsNumeric(txtAlCastingsScrap) Then Call updateCell(28, "ad", txtAlCastingsScrap / 100)
        If IsNumeric(txtStCastingsScrap) Then Call updateCell(28, "ai", txtStCastingsScrap / 100)
    End If
End Sub
Sub UpdateStage3()
    Sheets("Data Entry").Select
    Call CheckForEmptys(2)
    If filledin Then
        Call updateCell(32, "ad", txtLitresGas)
        Call updateCell(33, "ad", txtLitresDiesel)
        If IsNumeric(txtBiofuel) Then Call updateCell(34, "ad", txtBiofuel / 100)
        Call updateCell(35, "ad", txtLpg)
        Call updateCell(36, "ad", txtMJEnergy)
        Call updateCell(37, "ad", cmbGrid)
        If IsNumeric(txtAirFriction) Then Call updateCell(38, "ad", txtAirFriction / 100)
        Call updateCell(39, "ad", txtLifeTimeDistance)
        
        With Worksheets("Calculations - Use stage")
            If cmbGrid = "Global" Then
                Call updateCell(50, "aa", "='Data sources'!F14")
            ElseIf cmbGrid = "North America" Then
                Call updateCell(50, "aa", "='Data sources'!F15")
            ElseIf cmbGrid = "Europe" Then
                Call updateCell(50, "aa", "='Data sources'!F16")
            End If
        End With
        End If
End Sub
Sub UpdateStage4()
    Sheets("Data Entry").Select
    Call CheckForEmptys(3)
    If IsNumeric(txtVehiclesRecycled) Then Call updateCell(43, "ad", txtVehiclesRecycled / 100)
    If IsNumeric(txtAlDismantled) Then Call updateCell(46, "ad", txtAlDismantled / 100)
    If IsNumeric(txtStDismantled) Then Call updateCell(46, "ai", txtStDismantled / 100)
    If IsNumeric(txtAlShredded) Then Call updateCell(47, "ad", txtAlShredded / 100)
    If IsNumeric(txtStShredded) Then Call updateCell(47, "ai", txtStShredded / 100)
    If IsNumeric(txtAlEm) Then Call updateCell(48, "ad", txtAlEm / 100)
    If IsNumeric(txtLAlDismantled) Then Call updateCell(50, "ad", txtLAlDismantled / 100)
    If IsNumeric(txtLStDismantled) Then Call updateCell(50, "ai", txtLStDismantled / 100)
    If IsNumeric(txtLAlShredding) Then Call updateCell(51, "ad", txtLAlShredding / 100)
    If IsNumeric(txtLStShredding) Then Call updateCell(51, "ai", txtLStShredding / 100)
    If IsNumeric(txtAlEMSorting) Then Call updateCell(52, "ad", txtAlEMSorting / 100)
    If IsNumeric(txtAlCarShred) Then Call updateCell(53, "ad", txtAlCarShred / 100)
    If IsNumeric(txtStCarShred) Then Call updateCell(53, "ai", txtStCarShred / 100)
    If IsNumeric(txtAlSinkFloat) Then Call updateCell(54, "ad", txtAlSinkFloat / 100)
    If IsNumeric(txtAlEAF) Then Call updateCell(55, "ad", txtAlEAF / 100)
    If IsNumeric(txtStEAF) Then Call updateCell(55, "ai", txtStEAF / 100)
    If IsNumeric(txtAlEAFCorrection) Then Call updateCell(56, "ad", txtAlEAFCorrection / 100)
    If IsNumeric(txtStEAFCorrection) Then Call updateCell(56, "ai", txtStEAFCorrection / 100)
    If IsNumeric(txtALRecoveredScrap) Then Call updateCell(57, "ad", txtALRecoveredScrap / 100)
End Sub
Sub FinalBits()
    lblHelp.Visible = False
    btnSave.Visible = True
    btnPrint.Visible = True
    btnRestart.Visible = True
   
    Sheets("Results").Select
    
    updateResultsCode ("AL3")
    updateResultsCode ("AL5")
    updateResultsCode ("AL7")
       
    updateResultsInfo ("AB5")
    updateResultsInfo ("AB7")
    updateResultsInfo ("AB8")
    updateResultsInfo ("AB9")
    updateResultsInfo ("AB10")
    updateResultsInfo ("AB11")
    updateResultsInfo ("AB12")
  
    updateResultsLoads ("AB17")
    updateResultsLoads ("AE17")
    updateResultsLoads ("AI17")
    updateResultsLoads ("AL17")
    updateResultsLoads ("AB21")
    updateResultsLoads ("AE21")
    updateResultsLoads ("AI21")
    updateResultsLoads ("AL21")
    updateResultsLoads ("AE19")
    updateResultsLoads ("AL19")
    updateResultsLoads ("AB23")
    updateResultsLoads ("AE23")
    updateResultsLoads ("AI23")
    updateResultsLoads ("AL23")
    updateResultsLoads ("AB25")
    updateResultsLoads ("AE25")
    updateResultsLoads ("AI25")
    updateResultsLoads ("AL25")
    
    updateResultsGHGSavings ("AE30")
    updateResultsGHGSavings ("AE32")
    updateResultsGHGSavings ("AE34")
    updateResultsGHGSavings ("AI30")
    updateResultsGHGSavings ("AI32")
    updateResultsGHGSavings ("AI34")

    updateResultsCarbonFootprint ("AB39")
    updateResultsCarbonFootprint ("AB41")
    updateResultsCarbonFootprint ("AB43")
    updateResultsCarbonFootprint ("AE39")
    updateResultsCarbonFootprint ("AE41")
    updateResultsCarbonFootprint ("AE43")

    updateResultsRecyclingRate ("AB47")
    updateResultsRecyclingRate ("AB49")
    updateResultsRecyclingRate ("AE47")
    updateResultsRecyclingRate ("AE49")

End Sub
Private Sub btnCancel_Click()
    Dim msg As String
    Dim ans As Integer
    msg = "Return to spreadsheet?"
    ans = MsgBox(msg, vbQuestion + vbYesNo, "Transport Model Data Entry")
    Application.ScreenUpdating = True
    Application.Visible = True
    If ans = vbYes Then Unload Me
End Sub
Private Sub btnNext_Click()
    filledin = True
    If mpgeMain.Value = 0 Then UpdateStage1
    If mpgeMain.Value = 1 Then UpdateStage2
    If mpgeMain.Value = 2 Then UpdateStage3
    If filledin Then
        mpgeMain.Value = mpgeMain.Value + 1
        UpdateControls
    Else
        MsgBox ("All entries must be filled")
    End If
End Sub
Private Sub btnPrevious_Click()
    mpgeMain.Value = mpgeMain.Value - 1
    UpdateControls
End Sub
Private Sub btnFinish_Click()
    filledin = True
    If mpgeMain.Value = 3 Then UpdateStage4
    If filledin Then
        Call FinalBits
        btnResults.Enabled = True
        btnDataSources.Enabled = True
        btnCalculations.Enabled = True
        btnAnalysis.Enabled = False
        btnFinish.Enabled = False
        mpgeMain.Value = 4
        lblStage = ""
        lblTitle = "Results"
        btnNext.Enabled = False
        btnPrevious.Enabled = False
    End If
End Sub
Private Sub btnDataSources_Click()
    mpgeMain.Value = 6
    lblStage = ""
    lblTitle = "Data Sources"
End Sub
Private Sub btnCalculations_Click()
    mpgeMain.Value = 7
    lblStage = ""
    lblTitle = "Calculations"
End Sub
Private Sub btnResults_Click()
    mpgeMain.Value = 4
    lblStage = ""
    lblTitle = "Results"
End Sub
Private Sub txtUnFlSt_Enter()
    updateHelp (17)
End Sub
Private Sub UserForm_Initialize()
    startup = True
    cmbGrid.AddItem ("Global")
    cmbGrid.AddItem ("North America")
    cmbGrid.AddItem ("Europe")
    cmbGrid = "Global"
    Call LoadFromDataEntry
    Application.ScreenUpdating = False
    Application.Visible = False
    flip = False
    startup = False
    Call updateRecyclingRate
End Sub
Sub UserForm_queryunload(Cancel As Integer, unloadmode As Integer)
    If MsgBox("Are you sure?", vbYesNo, "Quit") = vbNo Then Cancel = 1
    Application.Visible = True
End Sub
Private Sub UserForm_Terminate()
    Sheets("Start").Select
    Application.ScreenUpdating = True
    Application.Visible = True
End Sub



syntax highlighted by Code2HTML, v. 0.9.1