hi
I have this code but I'm stucking , my idea depends on prevent user from add a new sheet it pop warning message and show inputbox to add the password if the password is right then unprotect the file and enable to add a new sheets and if the password is wrong then pop message inform me wrong password and continue show inputbox until put the right password and if i press cancel then exit sub .
Private Sub Workbook_NewSheet(ByVal Sh As Object)
Const myPwd As String = "qwe"
Dim ans
ActiveWorkbook.Protect Password:=myPwd
Application.DisplayAlerts = False
ActiveSheet.Delete
MsgBox "Sorry, Adding new Sheet is not allowed"
ans = InputBox("YOur code", "Modify")
If ans <> myPwd Then MsgBox "Sorry, the password is not correct": ans = InputBox("YOur code", "Modify")
If ans = myPwd Then ActiveWorkbook.Unprotect Password:=myPwd
ActiveWorkbook.Sheets.Add
End Sub