Propriété Protection.AllowEditRanges (Excel)

Renvoie un objet AllowEditRanges .

Syntaxe

expression. AllowEditRanges

Expression Variable qui représente un objet Protection .

Exemple

Dans cet exemple, Microsoft Excel autorise des modifications dans la plage A1:A4 de la feuille de calcul active et indique à l'utilisateur le titre et l'adresse de la plage spécifiée.

Sub UseAllowEditRanges() 
 
 Dim wksOne As Worksheet 
 Dim strPwd1 As String 
 
 Set wksOne = Application.ActiveSheet 
 
 strPwd1 = InputBox("Enter Password") 
 
 ' Unprotect worksheet. 
 wksOne.Unprotect 
 
 ' Establish a range that can allow edits 
 ' on the protected worksheet. 
 wksOne.Protection.AllowEditRanges.Add _ 
 Title:="Classified", _ 
 Range:=Range("A1:A4"), _ 
 Password:=strPwd1 
 
 ' Notify the user 
 ' the title and address of the range. 
 With wksOne.Protection.AllowEditRanges.Item(1) 
 MsgBox "Title of range: " & .Title 
 MsgBox "Address of range: " & .Range.Address 
 End With 
 
End Sub

Assistance et commentaires

Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.