Appliquer une VBA à toute une feuille

bonjour,

j aimerais savoir comment appliquer cette formule,

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("A3")) Is Nothing Then

If Target.Value = "" Then Range("C3:V3").ClearContents

End If

End Sub

aux 57 lignes de ma feuille

merci

Bonjour,

il suffit de copier cette formule dans le module de la feuille. (clic droit,sur onglet feuil- voir le code )

Joins un fichier, c'est plus commode.

Amicalement

Pierrot

Voila mon dossier

Voilà Didier,

J'ai copié la procédure dans le module de la feuille "A"

il y a très peu d'explications sur la feuille.

Amicalement

Pierrot

Bonjour,

Une autre approche de la question :

Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Application.Intersect(Target, Range("A3:A60")) Is Nothing Then
        If Target.Count > 1 Then Exit Sub
        If Target.Value = "" Then Range("C" & Target.Row & ":V" & Target.Row).ClearContents
    End If

End Sub

nb : ne devrait-on pas effacer à partir de la colonne B?

je me suis trompé sur la formule, en effet, il faut vider la ligne si je supprime la date en cellule B

voici la bonne formule

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("B3")) Is Nothing Then

If Target.Value = "" Then Range("C3:K3").ClearContents

End If

End Sub


Jean-Eric a écrit :

Bonjour,

Une autre approche de la question :

Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Application.Intersect(Target, Range("B3:B60")) Is Nothing Then
        If Target.Count > 1 Then Exit Sub
        If Target.Value = "" Then Range("C" & Target.Row & ":K" & Target.Row).ClearContents
    End If

End Sub

nb : ne devrait-on pas effacer à partir de la colonne B?

En effet jean eric, il faut se fier a la colonne B.

ta formule est exactement ce que je voulais, je te remercie, sauf, qu'il ne faudrait pas que ca m efface la formule qu'il y a un "C"

Bonjour,

Cette modification apporte-t-elle satisfaction?

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Application.Intersect(Target, Range("A3:A60")) Is Nothing Then
        If Target.Count > 1 Then Exit Sub
        If Target.Value = "" Then
            Range("B" & Target.Row).ClearContents
            Range("D" & Target.Row & ":V" & Target.Row).ClearContents
        End If
    End If

End Sub
Jean-Eric a écrit :

Bonjour,

Cette modification apporte-t-elle satisfaction?

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Application.Intersect(Target, Range("A3:A60")) Is Nothing Then
        If Target.Count > 1 Then Exit Sub
        If Target.Value = "" Then
            Range("B" & Target.Row).ClearContents
            Range("D" & Target.Row & ":V" & Target.Row).ClearContents
        End If
    End If

End Sub

non, c est pas bon mais en fait, si je fais

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("B3:B60")) Is Nothing Then

If Target.Count > 1 Then Exit Sub

If Target.Value = "" Then Range("D" & Target.Row & ":K" & Target.Row).ClearContents

End If

End Sub

au lieu de

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("B3:B60")) Is Nothing Then

If Target.Count > 1 Then Exit Sub

If Target.Value = "" Then Range("C" & Target.Row & ":K" & Target.Row).ClearContents

End If

End Sub

c est parfait.

merci a vous


Autre question tant que je vous tiens, pourquoi je ne peux faire "revenir en arrière" lorsque je vide ma ligne avec votre formule ?

Rechercher des sujets similaires à "appliquer vba toute feuille"