Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Row < 4 Or Target.Row > 43 Then Exit Sub
If Target.Column = 15 Then Règlé (Target.Row): Cancel = True
If Target.Column < 3 Or Target.Column > 12 Then Exit Sub
Cancel = True
[COLOR=red][B]Sheets("Fiche de renseignement").Unprotect "MotDePasse"[/B][/COLOR]
If Target = "" Then Target = "X" Else Target = ""
[B][COLOR=red]Sheets("Fiche de renseignement").Protect "MotDePasse"[/COLOR][/B]
End Sub
Sub Règlé(Ligne As Integer)
Dim DerLigne As Integer, I As Integer, Concaténation As String
[COLOR=red][B]Sheets("Fiche de renseignement").Unprotect "MotDePasse"[/B][/COLOR]
With Sheets(Format(Cells(Ligne, 2), "mmmm"))
DerLigne = .Range("A65535").End(xlUp).Row + 1
.Cells(DerLigne, 1) = Cells(Ligne, 2)
.Cells(DerLigne, 2) = Cells(Ligne, 1)
For I = 3 To 12
If Cells(Ligne, I) = "X" Then
Concaténation = Concaténation & Cells(2, I) & " + "
End If
Next I
Concaténation = Left(Concaténation, Len(Concaténation) - 3)
.Cells(DerLigne, 3) = Concaténation
.Cells(DerLigne, 4) = Sheets("Gestion client").Cells(Sheets("Gestion client").Columns(3).Find(Cells(Ligne, 1), LookAt:=xlWhole).Row, 18)
Select Case Range("N" & Ligne)
Case "Espèces"
.Cells(DerLigne, 5) = Cells(Ligne, 13)
Case "Chèque"
.Cells(DerLigne, 6) = Cells(Ligne, 13)
Case "Carte bleue"
.Cells(DerLigne, 7) = Cells(Ligne, 13)
End Select
End With
Range("A" & Ligne & ":L" & Ligne).ClearContents
Range("N" & Ligne).ClearContents
[COLOR=red][B]Sheets("Fiche de renseignement").Protect "MotDePasse"[/B][/COLOR]
End Sub
Private Sub CommandButton1_Click()
If OptionButton1.Value = False And OptionButton2.Value = False Then
Label17.Visible = True
Exit Sub
End If
Application.ScreenUpdating = False
[COLOR=red][B]Sheets("Fiche de renseignement").Unprotect "MotDePasse"[/B][/COLOR]
Sheets("Gestion client").Select
DerLigne = Range("B65535").End(xlUp).Row + 1
Cells(DerLigne, 2).Value = DTPicker1.Value
Cells(DerLigne, 3).Value = TextBox1.Value
Cells(DerLigne, 4).Value = TextBox2.Value
Cells(DerLigne, 5).Value = TextBox3.Value
Cells(DerLigne, 6).Value = TextBox4.Value
Cells(DerLigne, 7).Value = TextBox6.Value
Cells(DerLigne, 8).Value = TextBox5.Value
Cells(DerLigne, 9).Value = TextBox7.Value
If OptionButton1.Value = True Then
Cells(DerLigne, 10).Value = TextBox8.Value
End If
If OptionButton2.Value = True Then
Cells(DerLigne, 11).Value = TextBox8.Value
End If
Cells(DerLigne, 12).Value = ComboBox1.Value
Cells(DerLigne, 13).Value = TextBox10.Value
Cells(DerLigne, 14).Value = TextBox13.Value
Cells(DerLigne, 15).Value = TextBox14.Value
Cells(DerLigne, 16).Value = TextBox15.Value
Cells(DerLigne, 17).Value = TextBox11.Value
Cells(DerLigne, 18).Value = TextBox12.Value
ActiveWorkbook.Names("NomClient").RefersToR1C1 = "='Gestion client'!R5C3:R" & DerLigne & "C3"
[COLOR=red][B]Sheets("Fiche de renseignement").Protect "MotDePasse"[/B][/COLOR]
' effacement
OptionButton1.Value = False
OptionButton2.Value = False
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
ComboBox1.Value = ""
TextBox10.Value = ""
TextBox11.Value = ""
TextBox12.Value = ""
TextBox13.Value = ""
TextBox14.Value = ""
TextBox15.Value = ""
Label17.Visible = False
Application.ScreenUpdating = True
End Sub