Sub Reset()
Dim Name_OLD As String
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Name_OLD = ActiveSheet.Name 'sauvegarde l'ancien nom
Msg = "Confirmez-vous la réinitialisation ? Les données saisies sur cet onglet seront perdues." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Demande de confirmation" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
Application.ScreenUpdating = False
Application.DisplayAlerts = False
ActiveSheet.Delete 'supprime l'onglet
Worksheets("EC (0)").Visible = True 'affiche l'onglet vierge
Worksheets("EC (0)").Copy After:=Worksheets("EC (0)") 'copie l'ongelt vierge
'ActiveSheet.Visible = True
ActiveSheet.Name = Name_OLD 'renomme le nouvel onglet
Worksheets("EC (0)").Visible = False 'masque l'onglet vierge
Else ' User chose No.
MyString = "Réinitialisation annulée" ' Perform some action.
End If
With ActiveSheet
.EnableAutoFilter = True
.EnableOutlining = True
.Protect Contents:=True, UserInterfaceOnly:=True, AllowFormattingCells:=True, AllowInsertingRows:=True, AllowDeletingRows:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True
End With
'Application.ScreenUpdating = True
End Sub