Bonjour,
J'utilise actuellement la macro ci-dessous qui fonctionne très pour Afficher/masquer les feuilles comportant le même nom que la cellules sur laquelle j'effectue un clic droit. (exemple en PJ)
Cependant j'aimerais mettre un mot de passe sur l’affichage des feuilles, j'ai testé plusieurs solutions mais je ne trouve pas ...
Il doit falloir rajouter une condition dans ces lignes mais je ne sais pas lesquelles ...
Sheets(CStr(Target.Value)).Visible = -1
Sheets(CStr(Target.Value)).Select
Quelqu'un pourrait-il m'aider ?
Par avance merci beaucoup ?
Cordialement,
Option Explicit
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("C73:C83")) Is Nothing Then
Cancel = True
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
If Not FeuilExist(CStr(Target.Value)) Then
MsgBox "Feuille inéxistante", vbCritical
Exit Sub
Else
Sheets(CStr(Target.Value)).Visible = -1
Sheets(CStr(Target.Value)).Select
End If
End If
If Not Intersect(Target, Range("D7383")) Is Nothing Then
Cancel = True
If Target = "" Then Exit Sub
If Not FeuilExist(CStr(Target.Value)) Then
MsgBox "Feuille inéxistante", vbCritical
Exit Sub
Else
Sheets(CStr(Target.Value)).Visible = 2
End If
End If
End Sub
J'utilise actuellement la macro ci-dessous qui fonctionne très pour Afficher/masquer les feuilles comportant le même nom que la cellules sur laquelle j'effectue un clic droit. (exemple en PJ)
Cependant j'aimerais mettre un mot de passe sur l’affichage des feuilles, j'ai testé plusieurs solutions mais je ne trouve pas ...
Il doit falloir rajouter une condition dans ces lignes mais je ne sais pas lesquelles ...
Sheets(CStr(Target.Value)).Visible = -1
Sheets(CStr(Target.Value)).Select
Quelqu'un pourrait-il m'aider ?
Par avance merci beaucoup ?
Cordialement,
Option Explicit
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("C73:C83")) Is Nothing Then
Cancel = True
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
If Not FeuilExist(CStr(Target.Value)) Then
MsgBox "Feuille inéxistante", vbCritical
Exit Sub
Else
Sheets(CStr(Target.Value)).Visible = -1
Sheets(CStr(Target.Value)).Select
End If
End If
If Not Intersect(Target, Range("D7383")) Is Nothing Then
Cancel = True
If Target = "" Then Exit Sub
If Not FeuilExist(CStr(Target.Value)) Then
MsgBox "Feuille inéxistante", vbCritical
Exit Sub
Else
Sheets(CStr(Target.Value)).Visible = 2
End If
End If
End Sub