[RÉSOLU] Faire cohabiter 2 actions dans un seul Worksheet_Change

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

aubelix

XLDnaute Impliqué
Bonsoir à tous les Amis du Forum.
Une nouvelle fois besoin de votre aide pour savoir s'il était possible de
faire cohabiter 2 actions sur Worksheet_Change.
Ou une autre solution ?

Par avance, Merci pour votre aide.
Cordialement.

'Ecrire la date de modification dans la colonne R correspondant à la ligne de la date
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("D D")) Is Nothing Then
If Target <> "" Then Range("R" & Target.Row) = Date
End If
End Sub


'le code suivant empêche l'utilisateur
'd'effacer le contenu de la cellule "J1"e date du jour

If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
If Not IsEmpty(Range("A1")) Then Exit Sub
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End Sub


 
Dernière édition:
Re : Faire cohabiter 2 actions dans un seul Worksheet_Change

Bonjour à tous,

Avec ce que j'ai compris :

VB:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Target, Range("D:D")) Is Nothing Then
        If Target <> "" Then Range("R" & Target.Row) = Date
    End If
    If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
    If Not IsEmpty(Range("A1")) Then Exit Sub
    Application.EnableEvents = False
    Application.Undo
    Application.EnableEvents = True
End Sub

A+ à tous
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
9
Affichages
508
  • Question Question
Microsoft 365 worksheet_change
Réponses
29
Affichages
1 K
Réponses
4
Affichages
521
Retour