Bonjour,
Ce code fonctionne bien pour afficher une case à cocher devant chaque ligne sauf que je n'arrive pas à changer la valeur obtenue par cette case à cochée de FAUX ou VRAI à 1 ou 2 et ça m'affiche une erreur quand je l'essaye
Sub AddCheckBoxes()
Dim i, LRow As Single
Dim chkbx As CheckBox
Dim MyLeft, MyTop, MyHeight, MyWidth As Double
Application.ScreenUpdating = False
LRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LRow
If Cells(i, "A").Value <> "" Then
If Cells(i, "C").Value <> "" Then
Cells(i, "C").ClearContents
ActiveSheet.Shapes.Cells(i, "C").Select
Selection.delete
ElseIf IsEmpty(Cells(i, "C")) Then
MyLeft = Cells(i, "C").Left
MyTop = Cells(i, "C").Top
MyHeight = Cells(i, "C").Height
MyWidth = Cells(i, "C").Width
With ActiveSheet.CheckBoxes.Add(MyLeft, MyTop, MyWidth, MyHeight)
.Name = "CheckBox" & i
.Caption = ""
.Value = xlOff
.LinkedCell = "D" & i
.Display3DShading = False
End With
End If
If Range("C" & i).chkbx.Value = xlOn Then
Range("B" & i).Value = 2
ElseIf Range("C" & i).chkbx.Value = xlOff Then
Range("B" & i).Value = 1
End If
End If
Next i
Application.ScreenUpdating = True
End Sub