Exit when Cancel clicked.
Hi Claus
thank you! It works fine if they click cancel, but if they input something it's giving this error "run time error 1004 application-defined error or object-defined error"
Below is the full code including your additions.
Sub Events_Add_Category()
Dim emptyRow As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
strSheetName = ActiveSheet.Name
'Make Event Budget Inputs sheet active
Sheets("Event Budget Inputs").Activate
'Transfer information from form to Event Budget Inputs sheet
val1 = InputBox("Enter the new Category", "BizApp New Category")
If val1 = "" Or val1 = Chr(32) Then Exit Sub
val2 = InputBox("Enter the budgeted amount for the new Category", "BizApp New Category")
If val2 = "" Or val1 = Chr(32) Then Exit Sub
Cells(emptyRow, 3).Value = val1
Cells(emptyRow, 4).Value = val2
MsgBox "New Category added."
Sheets(strSheetName).Select
Call Event_Sort_Category
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
|