Share via


Propriedade Protection.AllowSorting (Excel)

Retorna True se a opção de classificação for permitida em uma planilha protegida. Boolean somente leitura.

Sintaxe

expressão. Allowsorting

Expressão Uma variável que representa um objeto Protection .

Comentários

A classificação pode ser feita somente em células desbloqueadas ou desprotegidas em uma planilha protegida.

A propriedade AllowSorting pode ser definida usando os argumentos do método Proteger .

Exemplo

Este exemplo permite ao usuário classificar células desbloqueadas e desprotegidas na planilha protegida e notifica o usuário.

Sub ProtectionOptions() 
 
 ActiveSheet.Unprotect 
 
 ' Unlock cells A1 through B5. 
 Range("A1:B5").Locked = False 
 
 ' Allow sorting to be performed on the protected worksheet. 
 If ActiveSheet.Protection.AllowSorting = False Then 
 ActiveSheet.Protect AllowSorting:=True 
 End If 
 
 MsgBox "For cells A1 through B5, sorting can be performed on the protected worksheet." 
 
End Sub

Suporte e comentários

Tem dúvidas ou quer enviar comentários sobre o VBA para Office ou sobre esta documentação? Confira Suporte e comentários sobre o VBA para Office a fim de obter orientação sobre as maneiras pelas quais você pode receber suporte e fornecer comentários.