B
Brad
Are there standard checks for errors that the macro's below should have?
An application is being built to be used by others and the following code
works when everything is entered correctly. I have tried to anticipate some
of the problems caused by individual not using valid information. Please
note that data validation is being used extensively on the input fields - to
ensure that valid data is being entered.
Sub Print_pages()
Dim sht As Worksheet
For Each sht In Worksheets
If sht.Name <> "Input" And sht.Visible = True Then
sht.PrintOut
End If
Next
End Sub
Sub change_agent()
Sheets("Agent_information").Visible = True
ActiveWorkbook.Worksheets("Agent_information").Select
End Sub
Sub check_error()
Dim sht As Worksheet
For Each sht In Worksheets
If sht.Name <> "Input" Then
sht.Visible = False
End If
Next
If Range("input_info!valid").value <> 0 Then
Sheets("input").[button 17].Visible = False
Beep
End If
If Range("input_info!valid").value = 0 Then
Sheets("input").[button 17].Visible = True
Sheets("input").[button 248].Visible = True
Select Case Range("product").value
Case Is = "Capital_Bonus_2"
Sheets("CB2_Disclosure").Visible = True
Sheets("CB2_Values").Visible = True
Case Is = "Maximum_Solutions_II"
Sheets("Max2_Disclosure").Visible = True
Sheets("Max2_Values").Visible = True
Case Is = "Expanding_Horizon_5"
Sheets("EH5_Disclosure").Visible = True
Sheets("EH5_Values").Visible = True
Case Is = "Expanding_Horizon_7"
Sheets("EH7_Disclosure").Visible = True
Sheets("EH7_Values").Visible = True
Case Is = "GPA_5Yr"
Sheets("GPA5_Disclosure").Visible = True
Sheets("GPA_Values").Visible = True
Case Is = "GPA_9Yr"
Sheets("GPA9_Disclosure").Visible = True
Sheets("GPA_Values").Visible = True
Case Is = "GPA_Seminole_County"
Sheets("GPASC_Disclosure").Visible = True
Sheets("GPA_Values").Visible = True
Case Is = "MY_Guaranteed_Solution_II"
Sheets("MYGS_Disclosure").Visible = True
Sheets("MYGS_Values").Visible = True
Sheets("input").[button 248].Visible = False
Case Else
MsgBox "Not a valid plan"
End Select
End If
End Sub
Sub monthly_income_benefit_accumulation()
Worksheets("input_info").Range("c50").GoalSeek
goal:=Worksheets("input_info").Range("c52"), _
Changingcell:=Worksheets("input").Range("c13")
Application.ScreenUpdating = True
Worksheets("input").Range("c13") =
Application.WorksheetFunction.RoundUp(Worksheets("input").Range("c13"), 2)
If Worksheets("input").Range("c13") < 0 Then
Worksheets("input").Range("c13") = 0
End If
End Sub
An application is being built to be used by others and the following code
works when everything is entered correctly. I have tried to anticipate some
of the problems caused by individual not using valid information. Please
note that data validation is being used extensively on the input fields - to
ensure that valid data is being entered.
Sub Print_pages()
Dim sht As Worksheet
For Each sht In Worksheets
If sht.Name <> "Input" And sht.Visible = True Then
sht.PrintOut
End If
Next
End Sub
Sub change_agent()
Sheets("Agent_information").Visible = True
ActiveWorkbook.Worksheets("Agent_information").Select
End Sub
Sub check_error()
Dim sht As Worksheet
For Each sht In Worksheets
If sht.Name <> "Input" Then
sht.Visible = False
End If
Next
If Range("input_info!valid").value <> 0 Then
Sheets("input").[button 17].Visible = False
Beep
End If
If Range("input_info!valid").value = 0 Then
Sheets("input").[button 17].Visible = True
Sheets("input").[button 248].Visible = True
Select Case Range("product").value
Case Is = "Capital_Bonus_2"
Sheets("CB2_Disclosure").Visible = True
Sheets("CB2_Values").Visible = True
Case Is = "Maximum_Solutions_II"
Sheets("Max2_Disclosure").Visible = True
Sheets("Max2_Values").Visible = True
Case Is = "Expanding_Horizon_5"
Sheets("EH5_Disclosure").Visible = True
Sheets("EH5_Values").Visible = True
Case Is = "Expanding_Horizon_7"
Sheets("EH7_Disclosure").Visible = True
Sheets("EH7_Values").Visible = True
Case Is = "GPA_5Yr"
Sheets("GPA5_Disclosure").Visible = True
Sheets("GPA_Values").Visible = True
Case Is = "GPA_9Yr"
Sheets("GPA9_Disclosure").Visible = True
Sheets("GPA_Values").Visible = True
Case Is = "GPA_Seminole_County"
Sheets("GPASC_Disclosure").Visible = True
Sheets("GPA_Values").Visible = True
Case Is = "MY_Guaranteed_Solution_II"
Sheets("MYGS_Disclosure").Visible = True
Sheets("MYGS_Values").Visible = True
Sheets("input").[button 248].Visible = False
Case Else
MsgBox "Not a valid plan"
End Select
End If
End Sub
Sub monthly_income_benefit_accumulation()
Worksheets("input_info").Range("c50").GoalSeek
goal:=Worksheets("input_info").Range("c52"), _
Changingcell:=Worksheets("input").Range("c13")
Application.ScreenUpdating = True
Worksheets("input").Range("c13") =
Application.WorksheetFunction.RoundUp(Worksheets("input").Range("c13"), 2)
If Worksheets("input").Range("c13") < 0 Then
Worksheets("input").Range("c13") = 0
End If
End Sub