Il manque quelque chose dans macro mais quoi?

Bonjour le forum

Dans la macro ci-dessous lorsque je double clic par inadvertance cellule A2 ça met la date du jour

Alors qu'il y a dans la cellule Date

Merci à vous

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
ActiveSheet.Unprotect

    Init  'Module posologie
If Target.Column = 1 Then Target.Value = Date: Cancel = True
  If Not Intersect(Range("C3:C" & Range("A" & Rows.Count).End(xlUp).Row), Target) Is Nothing Then
    Cancel = True
    If Range("A" & Target.Row) = "" Then
      MsgBox "Double Click Cellule A3 pour Afficher la date"
      Exit Sub
    End If

    Target = IIf(Target = "VITAMINE D2 & D3", "", "VITAMINE D2 & D3")
  ElseIf Not Intersect(Range("B3:B" & Range("A" & Rows.Count).End(xlUp).Row), Target) Is Nothing Then
    Cancel = True
    Target = IIf(Target = NbAmpoule, "", NbAmpoule)  'NBAmpoule à la place de 1 à condition que le module Posologie soit présent

  End If
    If Target.Column = 9 And Target.Row >= 2 And Target.Row <= 102 Then
Application.EnableEvents = False
        With ActiveCell.Offset(0, -8).Resize(1, 8)

            If ActiveCell = "Non" Then
              ActiveCell = ""
            ElseIf ActiveCell = "" Then
               ActiveCell = "Oui"
              .Font.Strikethrough = True
            Else
               ActiveCell = "Non"
              .Font.Strikethrough = False
            End If

            '.Font.Strikethrough = Not .Font.Strikethrough
            ' ActiveCell = IIf(ActiveCell.Offset(0, -8).Font.Strikethrough, "Oui", "Non")

        End With

        With ActiveCell
            If .Offset(0, -8) <> "" And .Offset(0, -8).Font.Strikethrough = True Then  'Pour qu'on puisse afficher Oui ou NON il faut que la ligne de la colonne A soit renseigné
                .Interior.ColorIndex = 35
                .Font.ColorIndex = 5
            Else
              If ActiveCell = "" Then
                .Interior.ColorIndex = 36
              Else
                .Interior.ColorIndex = 40
                .Font.ColorIndex = 5
              End If
            End If
        End With
    End If
Cancel = True
Application.EnableEvents = True
End Sub

Bonjour,

Ben oui... Date pour VBA c'est la date du jour.

A+

Bonjour galopin01

Oups! Quel C$N

Merci à toi

Bonne journée

Rechercher des sujets similaires à "manque chose macro quoi"