le ocde de base:
1 2
| If Not Intersect(Target, Range("G5")) Is Nothing Then
If ActiveCell.Address = "$G$5" Then |
avec ceci vous voyez comment ajouter une autre cellule:
ajouter un Or a la condition if:
If Not Intersect(Target, Range("G5")) Is Nothing OR Not Intersect(Target, Range("G41")) Is Nothing
aussi pour la condition:
If ActiveCell.Address = "$G$5" or ActiveCell.Address = "$G$41" then
le code devient:
1 2 3 4 5 6 7 8 9
| Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sDate As Date
If Not Intersect(Target, Range("G5")) Is Nothing Or not Intersect(Target, Range("G41")) Is Nothing Then
If ActiveCell.Address = "$G$5" or ActiveCell.Address = "$G$41" Then
vDate = IIf(IsDate(Target.Value), Target.Value, Date)
UsFCalendrier.Show
End If
End If
End Sub |
Partager