共用方式為


Protection.AllowEditRanges 屬性 (Excel)

會傳回 AllowEditRanges 物件。

語法

運算式AllowEditRanges

表達 代表 Protection 物件的變數。

範例

在本範例中,Microsoft Excel 允許編輯使用中工作表上的範圍 A1:A4,並通知使用者指定範圍的標題和位址。

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

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應