Erreur VBA avec end if
F
bonjour,
Yvouile m'avait fait ce code que j'ai repris, il marche bien pour l'obligation de saisir un nom et un évênement. Parcontre la partie en bas qui permet que lorqu'on saisi en colonne "D" un évênement la date se met en colonne B et l'heure en C ne fonctionne plus, il me dit problème de if ! en même temps j'y connais pas grand chose en VBA...
merci pour votre aide :
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count > 1 Then Exit Sub
If Not Application.Intersect(Target, Range("F2:F65000")) Is Nothing Then
If Target.Offset(0, -5) = "" Then
MsgBox ("Veuillez saisir votre nom dans la colonne A")
Application.EnableEvents = False
Target = ""
Application.EnableEvents = True
Exit Sub
End If
If Not Application.Intersect(Target, Range("F2:F65000")) Is Nothing Then
If Target.Offset(0, -2) = "" Then
MsgBox ("Veuillez saisir un évènement dans la colonne D")
Application.EnableEvents = False
Target = ""
Application.EnableEvents = True
Exit Sub
End If
If Target.Column = 4 Then
Target.Offset(0, -2) = Date
Target.Offset(0, -1) = Format(Time, "h:m:s")
End If
End SubF
bon, j'ai trouvé la solution
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count > 1 Then Exit Sub
If Not Application.Intersect(Target, Range("F2:F65000")) Is Nothing Then
If Target.Offset(0, -5) = "" Then
MsgBox ("Veuillez saisir votre nom dans la colonne A")
Application.EnableEvents = False
Target = ""
Application.EnableEvents = True
Exit Sub
End If
End If
If Not Application.Intersect(Target, Range("F2:F65000")) Is Nothing Then
If Target.Offset(0, -2) = "" Then
MsgBox ("Veuillez saisir un évènement dans la colonne D")
Application.EnableEvents = False
Target = ""
Application.EnableEvents = True
Exit Sub
End If
End If
If Target.Column = 4 Then
Target.Offset(0, -2) = Date
Target.Offset(0, -1) = Format(Time, "h:m:s")
End If
End SubSinon, qu'est-ce que je pourrais mettre dans mon code pour que les personnes ne saississent rien dans la colonne B et C vue que la date et l'heure se saisissent toutes seules ?
Francky