Private Sub btnSolve_AddVar_Click()
'=========================================
'1. Obtain values of known variables
varName = txtSolve_VarName.Value
varValue = txtSolve_VarValue.Value
'=========================================
'2. Do check for errors
'Error: See if text is text, numbers are numbers
'--------------------------------------------------
If Application.WorksheetFunction.IsText(varValue) Then myError (2)
If Application.WorksheetFunction.IsNumber(varName) Then myError (2)
'Rest of code if no error
End Sub
Sub myError(x)
'=========================================
'Error Handling - Variable
'=========================================
Dim response
Select Case x
Case "1"
'1 refers to variable
response = MsgBox("Please do not use 'R' or 'C' as a variable", vbSystemModal + vbInformation, "ACTOM - Incorrect Value Entered!")
End
btnvSolve_Reset_Click
Case "2"
'2 refers to text or numbers being used wrong
response = MsgBox("Please ensure that the textbox has text and numbers in values", vbSystemModal + vbInformation, "ACTOM - Incorrect Value Entered!")
End
End Select
End Sub
Bookmarks