Re : Réparation d'onglets
Re le forum, homepyrof53
Merci encore, j'aurais du trouver la boucle,
j'ai adapté le code au fichier original, la macro me recrée bien le dossier ("Onglet") avec le nom et prénom mais les autres infos ne sont pas au bon endroit, pourtant j'utilise l'instruction cells(x,y).
le code:
'Module REPARATION DOSSIER
Unload Me
If Lbx1.ListCount = 0 Then Exit Sub
Dim L As Long, N As Long, Dl As Long
Dl = Cells(Rows.Count, 2).End(xlUp).Row + 1
With Lbx1
For N = 0 To Lbx1.ListCount - 1
If .Selected(N) = True Then
var01 = .List(N) 'Nom et Prénom
Sheet_copy "Modele", var01, True
l1 = N + 2 'Numéro de la ligne dans la feuille Amdinistrateur
Cells(5, 5) = Feuil006.Cells(l1, 47) 'Nom et Prénom
Cells(7, 5) = Feuil006.Cells(l1, 49) 'Date de naissance
Cells(11, 7) = Feuil006.Cells(l1, 48) 'Sexe
Cells(5, 9) = Feuil006.Cells(l1, 50) 'Adresse
Cells(5, 14) = Feuil006.Cells(l1, 51) 'Tel.1
Cells(5, 16) = Feuil006.Cells(l1, 52) 'Tel.2
Cells(5, 18) = Feuil006.Cells(l1, 53) 'Tel.3
Cells(13, 3) = Feuil006.Cells(l1, 45) 'Type
If Feuil006.Cells(l1, 44) = "C" Then
Cells(15, 3) = "Colmar" 'MA - Colmar
Else
Cells(15, 3) = "Mulhouse" 'MA - Mulhouse
End If
Cells(15, 5) = Feuil006.Cells(l1, 42) 'Date Début
Cells(15, 7) = Feuil006.Cells(l1, 43) 'Date Fin
Cells(15, 9) = Feuil006.Cells(l1, 54) 'GIPSE
Cells(15, 11) = Feuil006.Cells(l1, 46) 'Ecrou
Cells(13, 16) = Feuil006.Cells(l1, 60) 'CPIP
Cells(25, 2) = Feuil006.Cells(l1, 41) 'N° Dossier
If Feuil006.Cells(l1, 58) = "R" Then
Cells(20, 5) = "Agent RB" 'Agent RB
End If
If Feuil006.Cells(l1, 58) = "P" Then
Cells(20, 5) = "Agent PS" 'Agent PS
End If
If Feuil006.Cells(l1, 58) = "T" Then
Cells(20, 5) = "Agent TB" 'Agent TB
End If
Cells(20, 14) = Feuil006.Cells(l1, 55) 'MU
Cells(20, 16) = Feuil006.Cells(l1, 56) 'PID
If Feuil006.Cells(l1, 45) = "PSEM" Then
Cells(20, 18) = Feuil006.Cells(l1, 57) 'TU
End If
'Incrémente le nombre de Dossiers
Range("VDossier") = Range("VDossier") + 1
End If
Next
End With
Merci encore
Roby