Problème ouverture formulaire en VBA Excel
Bonjour,
Voici mon problème en essayant d'être clair.
Le code ci-dessous me permet, après avoir taper un mot de passe, et à la condition que la cellule soit vide, d'ouvrir un formulaire FrmAbs.
Le soucis est que si l'on ferme le formulaire, il n'est plus possible de l'activiter par un click dans une cellule.
Pouvez-vous m'aider s'il vous plait ?
Merci par avance
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Col As Long
Dim Lig As Long
Dim A As Long
Static PW As Boolean
If Not PW Then
motpasse = InputBox("Entrer le mot de passe...")
If motpasse = "6100" Then
PW = True
If Intersect(Range("ZO1"), ActiveCell) Is Nothing Then Exit Sub
If IsEmpty(ActiveCell.Value) Then
Lig = 5
Col = ActiveCell.Column
A = Cells(Lig, Col).Value
If A = 0 Then Col = Col - 1
If Weekday(Cells(Lig, Col).Value, 2) < 6 Then
If IsNumeric(Application.Match(Cells(Lig, Col), Sheets("Don").Range("fériés"), 0)) Then Exit Sub
End If
Load FrmAbs
FrmAbs.Show
End If
End If
End If
End Sub |