1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Private Sub ToggleButton1_Click()
ToggleButton1.Caption = IIf(ToggleButton1, "AM=PM", "AM<>PM")
ToggleButton1.BackColor = IIf(ToggleButton1, vbGreen, vbRed)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D5:NE5,D11:NE11,D17:NE17,D23:NE23,D29:NE29,D35:NE35,D41:NE41,D52:NE52,D58:NE58")) Is Nothing Then
Debug.Print Target.Address
If ToggleButton1 Then
Target.Offset(2, 0) = Target
Else
Exit Sub
End If
End If
If Not Intersect(Target, Range("D7:NE7,D13:NE13,D19:NE19,D25:NE25,D31:NE31,D37:NE37,D43:NE43,D54:NE54,D60:NE60")) Is Nothing Then
Debug.Print Target.Address
If ToggleButton1 Then
Target.Offset(3, 0) = Target
Else
Exit Sub
End If
End If
A laquelle je souhaiterais associer une seconde macro:
If Target.Cells(1, 1) = "" Then
Reponse = MsgBox("Voulez-vous supprimer ?", vbYesNo)
If Reponse = vbNo Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End If
End Sub |
Partager