Workbook_SheetSelectionChange

simbahuru Messages postés 1 Date d'inscription   Statut Membre Dernière intervention   -  
michel_m Messages postés 16602 Date d'inscription   Statut Contributeur Dernière intervention   -
Impossible faire passer le code ci dessous : j'ai des cellule avec fond couleur et souhaite les verrouiller par le code suivant :
Private Sub Workbook_Open()
If ThisWorkbook.BuiltinDocumentProperties("Author").Value = "haha" Then
Application.DisplayFullScreen = False
Application.DisplayFormulaBar = True
ActiveSheet.Unprotect Password:="haha"
Else
Application.DisplayFullScreen = False
Application.DisplayFormulaBar = False
End If
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
With ActiveCell
.Locked = True <----------- c'est là que ca plante
.FormulaHidden = True
End With
If ThisWorkbook.BuiltinDocumentProperties("Author").Value <> "haha" Then
ElseIf Target.Interior.Color = RGB(255, 192, 0) Then
ActiveCell.Locked = False
ActiveCell.FormulaHidden = False
End If
End Sub

1 réponse

michel_m Messages postés 16602 Date d'inscription   Statut Contributeur Dernière intervention   3 314
 
Bonjour,
je viens d'essayer(XL2007,Windows) et ca marche
0