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

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:

JCGL

XLDnaute Barbatruc
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
 

Discussions similaires

Statistiques des forums

Discussions
312 099
Messages
2 085 273
Membres
102 846
dernier inscrit
gilles45