I have a macro to copy a template and rename the new sheet after what user puts in inputbox.
If you put nothing and press OK or if you press Cancel I get error: application defined or object defined error.

What I would like is: if you put in nothing and press OK or if you press Cancel to exit sub and of course delete the sheet it copied and maybe a msg that nothing happened.
I tried if ... "false" and some other stuff but nothing worked.

This is my code:

Sub SheetsFromTemplate()
 Dim ActNm As String
 ActiveWorkbook.Sheets("douleia").Visible = True
 ActiveWorkbook.Sheets("douleia").Copy _
 After:=ActiveWorkbook.Sheets("apothiki")
 ActNm = ActiveSheet.Name
 ActiveSheet.Name = InputBox("Name of sheet.")
 
 Sheets(ActiveSheet.Name).Visible = True
 ActiveWorkbook.Sheets("douleia").Visible = False

    


End Sub
Thank you.