anthoYS
XLDnaute Barbatruc
Bonjour,
voilà mon problème : un fichier avec pour souhait le progrès dans certains domaines de ma vie, effort à effectuer). Et par double clic on affiche la date du jour en commentaire mais on colore la case concernée par le double clic. Cela doit être valide pour la colonne entièrement. Et la date doit rester à chaque fois.
Mon code n'est pas valable pour ce fichier, il colore que 3 cases et pas l'orange. Il concerne C, D, E, F et G. Les couleurs en F et G doivent être supprimer et on doit rajouter une colonne (orange à intercaler). Donc de C à F.
	
	
	
	
	
		
Merci beaucoup.
	
		
			
		
		
	
				
			voilà mon problème : un fichier avec pour souhait le progrès dans certains domaines de ma vie, effort à effectuer). Et par double clic on affiche la date du jour en commentaire mais on colore la case concernée par le double clic. Cela doit être valide pour la colonne entièrement. Et la date doit rester à chaque fois.
Mon code n'est pas valable pour ce fichier, il colore que 3 cases et pas l'orange. Il concerne C, D, E, F et G. Les couleurs en F et G doivent être supprimer et on doit rajouter une colonne (orange à intercaler). Donc de C à F.
		Code:
	
	
	Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   Dim dt As String
Dim lig
Dim col
col = Target.Column
lig = Target.Row
dt = Date
With Target
    If .Column > 2 And .Column < 8 Then
        Cancel = True
        If .Comment Is Nothing Then .AddComment
            .Comment.Shape.TextFrame.AutoSize = True
            .Comment.Text Text:=dt
    End If
End With
If col = 3 And Cells(lig, 2) = "" Then
Cells(lig, 3).Interior.ColorIndex = 3
Cells(lig, 9) = Date
Cells(lig, 10) = Time
Exit Sub
End If
If col = 3 And Cells(lig, 1) = "" Then
    Cells(lig, 2).Select
    Selection.Cut Destination:=Cells(lig, 1)
Cells(lig, 3).Interior.ColorIndex = 3
Cells(lig, 9) = Date
Cells(lig, 10) = Time
Exit Sub
End If
  If Target.Column >= 3 And Target.Column <= 5 Then
    If Target.Interior.ColorIndex = xlNone Then
      Range(Cells(Target.Row, 3), Cells(Target.Row, 5)).Interior.ColorIndex = xlNone
      Target.Interior.Color = Cells(2, Target.Column).Interior.Color
    Else
      Range(Cells(Target.Row, 3), Cells(Target.Row, 5)).Interior.ColorIndex = xlNone
    End If
  End If
   If Target.Column >= 6 And Target.Column <= 7 Then
    If Target.Interior.ColorIndex = xlNone Then
      Range(Cells(Target.Row, 6), Cells(Target.Row, 7)).Interior.ColorIndex = xlNone
      Target.Interior.Color = Cells(2, Target.Column).Interior.Color
    Else
      Range(Cells(Target.Row, 6), Cells(Target.Row, 7)).Interior.ColorIndex = xlNone
    End If
  End If
  End Sub
	Merci beaucoup.