bonjour à toutes et à tous,
pouvez m'aider sur le code suivant :
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Lg As Long
Dim Coul As Byte
Dim Pages
Dim I As Integer
Dim J As Long
Dim NumPage As Integer
If Target.Comment Is Nothing Then Target.AddComment ' Création commentaire
Target.Comment.Text Text:=Target.Comment.Text & _
Target.Value & " Modifié par:" & Environ("UserName") & _
" Le " & Now & vbLf
Target.Comment.Shape.TextFrame.AutoSize = True
If Range("BA1") = "" Then
Lg = 1
Coul = 3
Else
Lg = Range("BA" & Rows.Count).End(xlUp).Row
Coul = Range("BB" & Lg).Interior.ColorIndex
If Range("BB" & Lg) < Date Then
Coul = Coul + 1
If Coul = 57 Then Coul = 3
Lg = Lg + 1
End If
End If
Range("BA" & Lg) = "Date de la dernière modification"
With Range("BB" & Lg)
.NumberFormat = "m/d/yyyy"
.Interior.ColorIndex = Coul
.Value = Date
End With
End Sub
la ligne du code est surlignée et bugge :
If Target.Comment Is Nothing Then Target.AddComment ' Création commentaire
Je ne comprends pas pourquoi car j'ai repris ce code sur un autre fichier et sur ce dernier cela fonctionne
merci de vos lumières