I've got a workbook that users use a form control button to create additional sheets. I would also like to create a button to delete sheets if needed. The code below works to delete the sheet, but if the user tries to delete a sheet that doesn't exist it generates an error. Any way to modify the code so if a user enters the name of sheet that doesn't exist the macro won't generate an error?
Sub btnDeleteOrg() Dim orgname As Variant 'Delete Tab orgname = InputBox("Enter tab name:", "Enter Tab Name to Delete") If orgname = "" Then Exit Sub Sheets(orgname).Activate ActiveWorkbook.Unprotect ActiveWindow.SelectedSheets.Delete ActiveWorkbook.Protect End Sub