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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| Sub comparateur()
Dim Cel As Range
Dim j As Long, NbLg As Long, Ligne As Long
Dim F1 As Worksheet, F2 As Worksheet, F3 As Worksheet, F4 As Worksheet
Dim Colonnes
Dim LigneCopie As Boolean
Dim tem As Boolean
Dim Dico, i As Long, T
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Set F1 = Sheets("ISIS")
Set F2 = Sheets("Feuil1")
Set F3 = Sheets("Feuil2") 'Feuil3
Set F4 = Sheets("Feuil3") '
F2.Cells.Clear
F3.Cells.Clear
F4.Cells.Clear
'DICO --------------
Set Dico = CreateObject("Scripting.Dictionary")
With F1
T = .Range("B1:V" & .Range("V" & Rows.Count).End(xlUp).row)
End With
For i = LBound(T) To UBound(T)
Dico(T(i, 4)) = i
Next
'FIn DICO -----------
'initialisation du n° de ligne des onglets contenant les resultats des comparaisons
Ligne1 = 1
Ligne2 = 1
Ligne3= 1
' Stockage du fichier FAUST dans le tableau "ligne_fic"
Dim ff As Integer, cont_fic As String, k As Long, n As Long
ff = FreeFile
Open "C:\Users\e552538\Desktop\Outils\Comparaison FAUST_ISIS\Nouveau dossier\informations_2017.csv" For Input As #ff 'Nom complet du fichier à charger
cont_fic = Input(LOF(ff), #ff)
Close #ff
ligne_fic = Split(cont_fic, vbCrLf)
For k = 0 To UBound(ligne_fic)
'MsgBox ligne_fic(k) ' --->> on a là une ligne entière de 26 colonnes >> ligne_fic(k) =Ligne K
colonne_fic = Split(ligne_fic(k), ";")
For n = 0 To UBound(colonne_fic)
'MsgBox "la colonne " & n & " de la ligne " & k & " contient " & colonne_fic(n) ' >>> toto(n) Colonne n
Next n
Next k
MsgBox UBound(ligne_fic) & " Lignes sont présentes dans le fichier FAUST"
MsgBox " Chargement ISIS terminé"
LastLig = F1.Cells(F1.Rows.Count, "E").End(xlUp).row
MsgBox LastLig
'Parcours du fichier FAUST
For k = 1 To UBound(ligne_fic) - 1
colonne_fic = Split(ligne_fic(k), ";")
If Dico.Exists(colonne_fic(4)) Then
Ligne1 = Ligne1 + 1
F2.Range("A" & Ligne1).Resize(1, UBound(colonne_fic)) = colonne_fic
Ligne2 = Ligne2 + 1
F4.Range("B" & Ligne2).Resize(1, UBound(T, 2)) = Application.Index(T, Dico(colonne_fic(4)))
Else
Ligne3 = Ligne3 + 1
F3.Range("A" & Ligne3).Resize(1, UBound(colonne_fic)) = colonne_fic
End If
Next k
line = (Ligne1 - 1) / 2
MsgBox "sur les " & a & " lignes du fichiers de FAUST, on trouve " & line & " enregistrements identiques à ISIS et " & Ligne2 & " enregistrements non trouvés" |