What is the syntax to exit a procedure?

Exit Sub
#example - exits procedure if something error description happens
Private Sub btnAddNew_Click()
errorStr = errorCheck 'checks for errors ie. missing gaps in textfields

If Not (errorStr = "") Then 'if something wrong with wat user entered
     Exit Sub
End If

End Sub
Advertisements

What is the syntax to close a workbook?

ActiveWorkbook.Close SaveChanges:=<true/false>
#true if want to save changes before closing
#false if disregard changes before closing
#example
Private Sub btnExit_Click()
   ActiveWorkbook.Close SaveChanges:=True 
End Sub