Utiliser deux fois la même function sur excel
yazou
Messages postés
95
Statut
Membre
-
g Messages postés 1285 Statut Membre -
g Messages postés 1285 Statut Membre -
Bonjour,
J'ai cette fonction sous excel :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
If Cell.Column = Range("E:E").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "B").Value = Now
Else
Cells(Cell.Row, "B").Value = ""
End If
End If
Next Cell
End Sub
Elle sert à rajouter automatiquement la date dans la colonne B lorsque un champs de la colonne E est rempli...
Je veux faire la même chose avec la colonne C et la colonne H dans la même feuille excel..j'ai simplement essayé de redéclarer la fonction sous un autre nom et changé le nom des colonnes mais cela ne marche pas. Pourriez vous me dire comment ça marche ?
Merci
J'ai cette fonction sous excel :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
If Cell.Column = Range("E:E").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "B").Value = Now
Else
Cells(Cell.Row, "B").Value = ""
End If
End If
Next Cell
End Sub
Elle sert à rajouter automatiquement la date dans la colonne B lorsque un champs de la colonne E est rempli...
Je veux faire la même chose avec la colonne C et la colonne H dans la même feuille excel..j'ai simplement essayé de redéclarer la fonction sous un autre nom et changé le nom des colonnes mais cela ne marche pas. Pourriez vous me dire comment ça marche ?
Merci
A voir également:
- Utiliser deux fois la même function sur excel
- Comment utiliser chromecast sur tv - Guide
- Nombre de jours entre deux dates excel - Guide
- Liste déroulante excel - Guide
- Comment calculer la moyenne sur excel - Guide
- Word et excel gratuit - Guide
1 réponse
Bonjour,
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
If Cell.Column = Range("E:E").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "B").Value = Now
Else
Cells(Cell.Row, "B").Value = ""
End If
End If
If Cell.Column = Range("H:H").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "C").Value = Now
Else
Cells(Cell.Row, "C").Value = ""
End If
End If
Next Cell
End Sub
Bonne journée.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
If Cell.Column = Range("E:E").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "B").Value = Now
Else
Cells(Cell.Row, "B").Value = ""
End If
End If
If Cell.Column = Range("H:H").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "C").Value = Now
Else
Cells(Cell.Row, "C").Value = ""
End If
End If
Next Cell
End Sub
Bonne journée.