Quero proteger uma célula na qual tenho uma lista suspensa, mas ainda quero que a lista suspensa funcione.
Quando tento protegê-lo, o usuário não consegue usar a lista suspensa para selecionar outros itens ou macros.
Recebo esta mensagem de erro
"A célula ou gráfico que você está tentando alterar está protegido e, portanto, somente leitura. Para modificar uma célula ou gráfico protegido, primeiro remova a proteção usando o comando Planilha Desprotegida (guia Revisão, grupo Alterações). Pode ser solicitada uma senha ."
Responder1
O menu suspenso está anexado à célula. É onde ele armazena os dados. A validação garantirá que os dados são válidos.
Se ainda não o fez, certifique-se de que a célula não esteja bloqueada. Clique com o botão direito na célula e clique em formatar células e vá para a guia Proteção. A caixa de seleção Bloqueado deve estar desmarcada.
Responder2
Acho que esta pergunta pode ter sido mal interpretada. Se sim, e se estou interpretando corretamente, aqui está uma solução.
Na verdade, o Excel permite que um usuário de planilha substitua uma célula que usa uma lista de validação; se a lista incluísse os valores "Maçã", "Pêssego" e "Laranja", a operação padrão permite ao usuário digitar "Brócolis" na célula se ela estiver desprotegida, como se não houvesse nenhuma lista de validação anexada a ela. No entanto, proteger a célula e a planilha desativa a capacidade de selecionar um item da lista de validação e isso pode ser um problema.
Se esse for o problema, aqui está uma solução:
1. Format the cell using the validation list so it's
unprotected.
2. With the cursor positioned at that cell, open the
Validation menu origintally used to identify the validation
list.
3. On the Settings tab of the Data Validation window pane,
be sure that "ignore blank" is unchecked, and
continue to leave that window pane open.
4. On the "Error alert" tab of the Data Validation window
pane:
a) Be sure "Show error alert after invalid data is
entered" is checked.
b) Select "Stop" under the "Style" heading.
c) Give your error alert a name under "Title"; this
can be anything, but a short title is best.
d) Under "Error message", type a short message that you
want to appear if a user tries to manually type a value
in the cell - something like "Please use the drop-down
menu provided to select a value for this cell."
e) Click "OK".
Isso impedirá que as pessoas insiram o que quiserem em uma célula destinada a usar validação de dados, mesmo que a planilha esteja desprotegida. Mesmo assim, você pode querer proteger a planilha para evitar atualizações não intencionais na própria lista de validação de dados.
Responder3
No meu computador (PC com Excel 2010), a lista suspensa em si parece estar anexada à célula imediatamente à direita. Então, se eu quiser uma lista suspensa no A7, tenho que desbloquear o A7 e o B7.
Isso pode ser um bug, mas é uma solução relativamente simples.
Responder4
Em planilhas protegidas:
Cole o link abaixo na pasta de trabalho
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wsh As Variant
For Each wsh In Worksheets(Array("Sheet1"))
wsh.EnableOutlining = True
wsh.Protect UserInterfaceOnly:=True, Password:="", _
DrawingObjects:=False, _
Contents:=True, _
Scenarios:=True, _
AllowFormattingCells:=False, _
AllowFormattingColumns:=False, _
AllowFormattingRows:=False, _
AllowInsertingColumns:=False, _
AllowInsertingRows:=False, _
AllowInsertingHyperlinks:=False, _
AllowDeletingColumns:=False, _
AllowDeletingRows:=False, _
AllowSorting:=False, _
AllowFiltering:=False, _
AllowUsingPivotTables:=False
Next wsh
Dim Oldvalue As String
Dim Newvalue As String
On Error GoTo Exitsub
If Target.Address = "$C$2" Then 'As required
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
Else
Target.Value = Oldvalue & ", " & Newvalue
End If
End If
End If
Exitsub:
Application.EnableEvents = True
End Sub