Private Sub CheckBox6_Click()
If mem Then Exit Sub
If CheckBox6 Then
mdp = Application.InputBox("Veuillez saisir le mot de passe", "Autorisation de validation")
If mdp <> "jeremy0" Then
MsgBox "Mot de passe incorrect ! Tu n'es pas le C.U.E.T. Exploitation !", vbCritical
CheckBox6 = 0
Exit Sub
End If
End If
End Sub
Private Sub CommandButton1_Click()
Dim T As String
Dim I As Integer
For I = 1 To 6
If Me.Controls("CheckBox" & I).Value <> 0 Then
If T = "" Then
T = Me.Controls("CheckBox" & I).Caption 'incremente le nom de la checkbox
Else
T = T & "/" & Me.Controls("CheckBox" & I).Caption
End If
End If
Next
ActiveSheet.Range("F" & Me.Tag) = T
ActiveSheet.Range("F" & Me.Tag).WrapText = True
'si conducteur ok change color
If (Me.CheckBox1.Value And Me.CheckBox2.Value And Me.CheckBox3.Value And Me.CheckBox4.Value And Me.CheckBox5.Value) Then
'texte couleur
ActiveCell.Interior.ColorIndex = 8
'fond couleur
ActiveCell.Font.ColorIndex = 5
'si ok tous alors change color
If (Me.CheckBox1.Value And Me.CheckBox2.Value And Me.CheckBox3.Value And Me.CheckBox4.Value And Me.CheckBox5.Value And Me.CheckBox6) Then
ActiveCell.Interior.ColorIndex = 4
ActiveCell.Font.ColorIndex = 3
'copie coller
Dim nFichier As String, Dlig&, dl As Long
Dim wbSOURCE As Workbook, wbDESTINATION As Workbook
Dim A_COPIER As Range
' mettre le bon chemin
nFichier = "C:\Users\Jérémy\Desktop\ok\Nouveau dossier (2)\archive\TDB Historique 2014.xlsx"
Set wbSOURCE = ThisWorkbook
Dlig = wbSOURCE.Sheets(1).ActiveCell.Row
Set A_COPIER = wbSOURCE.Sheets("Tableau de Bord").Cells(Dlig, "A").Resize(, 7)
Set wbDESTINATION = Workbooks.Open(nFichier)
With wbDESTINATION
With .Sheets(1)
.Unprotect PassWord:="jeremy0"
A_COPIER.Copy
dl = .Cells(Rows.Count, 1).End(xlUp).Row
.Cells(dl + 1, 1).PasteSpecial xlValues
.Protect PassWord:="jeremy0"
End With
.Close True
End With
End If
End If
Unload Me
End Sub