Vous êtes sur la page 1sur 5

Private Sub txtrecherche_Change()

'listRecherchePv.Visible = False
listpersonnelagent.Clear
Sheets("Personnel").Activate
ss = Sheets("Personnel").Cells(Rows.Count, 2).End(xlUp).Row
k = 0
For Each c In Range("J2:J" & ss)
B = InStr(c, UCase(txtrecherche))
If B > 0 Then
listpersonnelagent.AddItem
' listRecherchePv.List(row( variable k), column = 0) = Cells((le premier row de la
liste c-a-d)c.Row, 2).Value
'LA VALEUR 4 POUR LA PROPRIETE COLUMNCOUNT
'listpersonnelagent.ColumnCount = 5
listpersonnelagent.List(k, 0) = Cells(c.Row, 10).Value
listpersonnelagent.List(k, 1) = Cells(c.Row, 11).Value
listpersonnelagent.List(k, 2) = Cells(c.Row, 12).Value
listpersonnelagent.List(k, 3) = Cells(c.Row, 13).Value
listpersonnelagent.List(k, 4) = Cells(c.Row, 14).Value
listpersonnelagent.List(k, 5) = Cells(c.Row, 7).Value
listpersonnelagent.List(k, 6) = Cells(c.Row, 8).Value
listpersonnelagent.List(k, 7) = Cells(c.Row, 9).Value

k = k + 1
End If
Next c

End Sub

'=============================================================
Private Sub listpersonnelagent_Click()
'l'enregestrement des selection sur les text box
Sheets("Personnel").Activate

'affictation des variable


NomLigne = usfperso.listpersonnelagent.ListIndex 'trouver le N de Ligne
NbLigne = usfperso.listpersonnelagent.ListCount ' trouve le nombre
d'enregistrement
usfperso.txtnombredenregistrements.Value = NbLigne

'chargement des information sur les text box

usfperso.txtpv.Value = Me.listpersonnelagent.Column(0, NomLigne) ' 0 la


premiere ligne
usfperso.txtMatricule.Value = Me.listpersonnelagent.Column(1, NomLigne)
usfperso.txtNom.Value = Me.listpersonnelagent.Column(2, NomLigne)
usfperso.txtprenom.Value = Me.listpersonnelagent.Column(3, NomLigne)
usfperso.txtfonction.Value = Me.listpersonnelagent.Column(4, NomLigne)
usfperso.txt_matricule_ca.Value = Me.listpersonnelagent.Column(5, NomLigne)
usfperso.txt_prenom_CA.Value = Me.listpersonnelagent.Column(6, NomLigne)
usfperso.txt_Nom_Ca.Value = Me.listpersonnelagent.Column(7, NomLigne)

txt_Agence.Text = txtpv.Value
'me.LblDS.Cancel=
'Me.txtpv.Value = Me.listpersonnelagent.Column(0, NomLigne)

'=================================================================================
End Sub

'==========================================================
Private Sub CmdAjouter_Click()
Dim i As Integer
i = 0
For X = 0 To listpersonnelagent.ListCount - 1
If listpersonnelagent.List(X) <> "" Then i = i + 1

txtnombredenregistrements.Text = i

Next
Select Case listpersonnelagent.ListIndex

Case 0
Sheets("Personnel").Range("w6").Value = txtpv.Value
Sheets("Personnel").Range("x6").Value = txtMatricule.Value
Sheets("Personnel").Range("y6").Value = txtNom.Value
Sheets("Personnel").Range("z6").Value = txtprenom.Value
Sheets("Personnel").Range("AA6").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 1
Sheets("Personnel").Range("w7").Value = txtpv.Value
Sheets("Personnel").Range("x7").Value = txtMatricule.Value
Sheets("Personnel").Range("y7").Value = txtNom.Value
Sheets("Personnel").Range("z7").Value = txtprenom.Value
Sheets("Personnel").Range("AA7").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 2
Sheets("Personnel").Range("w8").Value = txtpv.Value
Sheets("Personnel").Range("x8").Value = txtMatricule.Value
Sheets("Personnel").Range("y8").Value = txtNom.Value
Sheets("Personnel").Range("z8").Value = txtprenom.Value
Sheets("Personnel").Range("AA8").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 3
Sheets("Personnel").Range("w9").Value = txtpv.Value
Sheets("Personnel").Range("x9").Value = txtMatricule.Value
Sheets("Personnel").Range("y9").Value = txtNom.Value
Sheets("Personnel").Range("z9").Value = txtprenom.Value
Sheets("Personnel").Range("AA9").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 4
Sheets("Personnel").Range("w10").Value = txtpv.Value
Sheets("Personnel").Range("x10").Value = txtMatricule.Value
Sheets("Personnel").Range("y10").Value = txtNom.Value
Sheets("Personnel").Range("z10").Value = txtprenom.Value
Sheets("Personnel").Range("AA10").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 5
Sheets("Personnel").Range("w11").Value = txtpv.Value
Sheets("Personnel").Range("x11").Value = txtMatricule.Value
Sheets("Personnel").Range("y11").Value = txtNom.Value
Sheets("Personnel").Range("z11").Value = txtprenom.Value
Sheets("Personnel").Range("AA11").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 6
Sheets("Personnel").Range("w7").Value = txtpv.Value
Sheets("Personnel").Range("x7").Value = txtMatricule.Value
Sheets("Personnel").Range("y7").Value = txtNom.Value
Sheets("Personnel").Range("z7").Value = txtprenom.Value
Sheets("Personnel").Range("AA7").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 7
Sheets("Personnel").Range("w8").Value = txt_Nom_Ca.Value
Sheets("Personnel").Range("x8").Value = txt_matricule_ca.Value
Sheets("Personnel").Range("y8").Value = txt_prenom_CA.Value
'Sheets("Personnel").Range("z8").Value = txtprenom.Value
'Sheets("Personnel").Range("AA8").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)
Case 8
'Sheets("Personnel").Range("w8").Value = txtpv.Value

Sheets("Personnel").Range("w8").Value = txtpv.Value
Sheets("Personnel").Range("x9").Value = txtMatricule.Value
Sheets("Personnel").Range("y9").Value = txtNom.Value
Sheets("Personnel").Range("z9").Value = txtprenom.Value
Sheets("Personnel").Range("AA9").Value = txtfonction.Value
MsgBox ("vous avez ajouter le" & "N° " & listpersonnelagent.ListIndex)

End Select
If listpersonnelagent.Selected(i) > Val(txtnombredenregistrements) Then
CmdAjouter.Enabled = False

Rem exporter info ca


'==========================================================================
'Dim i As Integer
For i = 0 To listpersonnelagent.ListCount - 1
If listpersonnelagent.Selected(i) Then
Sheets("Personnel").Activate
Range("x8").Select
Range("x8").Value = Me.listpersonnelagent.Column(5, i)
Range("y8").Value = Me.listpersonnelagent.Column(6, i)
Range("z8").Value = Me.listpersonnelagent.Column(7, i)
Range("AA8").Value = "CA"

End If
Next
'===========================================================================

'Dim r As Long
'For r = 1 To usfperso.listpersonnelagent.ListCount - 1
'Sheets("Agence_personnel").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) =
usfperso.listpersonnelagent.List(r, 0)
'Sheets("Agence_personnel").Range("A" & Rows.Count).End(xlUp).Offset(0, 1) =
usfperso.listpersonnelagent.List(r, 1)
'Sheets("Agence_personnel").Range("A" & Rows.Count).End(xlUp).Offset(0, 2) =
usfperso.listpersonnelagent.List(r, 2)
'Sheets("Personnel").Range("w" & Rows.Count).End(xlUp).Offset(0, 5) =
usfperso.listpersonnelagent.List(r, 3)
'Sheets("Personnel").Range("x" & Rows.Count).End(xlUp).Offset(0, 6) =
usfperso.listpersonnelagent.List(r, 4)
'Next r
'MsgBox ("bien exportée!")
End Sub

'==================================================================================
=======

'ComboBox1.List = WorksheetFunction.Transpose(Feuil1.Range("j2:j2079"))
listRecherchePv.List = WorksheetFunction.Transpose(Feuil1.Range("j2:j2079"))
txtrecherche.SetFocus
listRecherchePv.Visible = False

'==================================================================================
=====

'==========saisie d'agence================================================
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'usfperso.listpersonnelagent.MultiSelect = 2
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Worksheets("Personnel_d_Agence").Activate
txtinspecteurs.Value = Sheets("Personnel_d_Agence").Range("x2")
txt_D_mission.Value = Sheets("Personnel_d_Agence").Range("v2")
txt_F_Mission.Value = Sheets("Personnel_d_Agence").Range("w2")

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' insertion des noms missionnaires
If txtinspecteurs.Text = "" Then
Dim p As String
p = InputBox("Merci de saisir les nom des Inspecteurs charger de la mission")

txtinspecteurs.Value = p
Sheets("Personnel_d_Agence").Range("x2") = p
End If
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'information sur la periode de la mission
Dim k_debut, k_fin As Date
If txt_D_mission.Text = "" And txt_F_Mission.Text = "" Then
k_debut = InputBox("Merci de saisir la date du début de la mission :")
k_fin = InputBox("Merci de saisir la date de la fin de la mission :")
txt_D_mission.Value = k_debut
txt_D_mission.Text = Format(txt_D_mission, "dd/mm/yyyy")
txt_F_Mission.Value = k_fin
txt_F_Mission.Text = Format(txt_F_Mission, "dd/mm/yyyy")
Sheets("Personnel_d_Agence").Range("v2") = k_debut
End If
'==================================================================================
===
'saisie région et DS:
If txt_DR = "" And txt_DS = "" Then
k_dr = InputBox("Merci de saisir la date du début de la mission :")
k_ds = InputBox("Merci de saisir la date de la fin de la mission :")

Sheets("Personnel_d_Agence").Range("B2").Value = k_ds
Sheets("Personnel_d_Agence").Range("A2").Value = k_dr
Sheets("Personnel_d_Agence").Range("B2").Value = txt_DS.Value
'Sheets("Personnel_d_Agence").Range("A2").Value = k_dr
Sheets("Personnel_d_Agence").Range("A2").Value = txt_DR.Value

End If
'==================================================================================
=====

End Sub

Vous aimerez peut-être aussi