Re : Suppression d'une checkbox dans une cellule donnée
En fait pour etre plus clair
Voici la macro de création d'une ligne :
Sub Nouvelle_Ligne()
Dim chk As CheckBox
Dim vcell As Range
Dim vrai As Range
ActiveCell.Range("A1:H1").Select
Selection.Insert Shift:=xlDown
ActiveCell.Offset(-1, 1).Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A2"), Type:=xlFillDefault
'ActiveCell.Range("A1:A2").Select
ActiveCell.Offset(0, 3).Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A2"), Type:=xlFillDefault
'ActiveCell.Range("A1:A2").Select
ActiveCell.Offset(0, 1).Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A3"), Type:=xlFillDefault
'ActiveCell.Range("A1:A3").Select
ActiveCell.Offset(0, 1).Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A3"), Type:=xlFillDefault
ActiveCell.Offset(0, -6).Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(0, 7).Select
' ActiveCell.Range("A1:A3").Select
Application.ScreenUpdating = False
For Each vcell In Selection
vcell.Select
Set chk = ActiveSheet.CheckBoxes.Add(30, 69, 0, 0)
With chk
.Text = ""
.Value = xlOff
.ShapeRange.Left = ActiveCell.Left
.ShapeRange.Top = ActiveCell.Top
.LinkedCell = ActiveCell.Range("P1").Address
.Display3DShading = True
End With
Next
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=$T$3:$T$33"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
ActiveCell.Range("A2").Select
End Sub
Et voici ma macro pour détruire une ligne
Sub Supprimer_ligne()
Dim chk As CheckBox
Dim vcell As Range
'
ActiveCell.Range("W1").Select
ActiveCell.Delete
ActiveCell.Offset(0, -22).Select
ActiveCell.Range("H1").Select
Application.ScreenUpdating = False
For Each vcell In Selection
vcell.Select
chk.Select
chk.Delete
Next
ActiveCell.Offset(0, -8).Select
ActiveCell.Range("A1:H1").Select
Selection.Delete Shift:=xlUp
ActiveCell.Offset(-1, 5).Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A3"), Type:= _
xlFillDefault
ActiveCell.Range("A1:A3").Select
ActiveCell.Range("A1").Select
ActiveCell.Offset(1, 2).Select
End Sub
Dans la macro de creation de ligne, j'insere une checkbox dans une cellule.
Je souhaiterais que quand je supprime cette ligne, la checkbox soit supprimée egalement.
Et c'est la que le bas blesse ("en gras" dans la macro)
Merci pour votre aide