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
| Public Sub comparaison()
Dim i, j, k As Integer
Dim Cell As Range
Dim newsaintlaurent As Variant
Windows(" Delta CP1-CP2 sur ASG.xls").Activate
'On compare les cellules
Range("A1").Select 'On se place sur la première des 2 colonnes
DernièreLigne = ActiveCell.End(xlDown).Row
Maplage = Range(Cells(1, 1), Cells(DernièreLigne, 1)).Address
Range("B1").Select 'On se place sur la deuxième des 2 colonnes
DernièreLigne2 = ActiveCell.End(xlDown).Row
Maplage2 = Range(Cells(1, 2), Cells(DernièreLigne2, 2)).Address
i = 2
While Cells(i, 2) <> ""
Maplage2new = Replace(Maplage2, " ", "")
Cells(i, 4) = Maplage2new(i)
i = i + 1
Wend
For Each Cel In Range(Maplage)
ok = Cel.Value <> Cells(Cel.Row, Cel.Column + 4).Value
If ok Then Cells(Cel.Row, Cel.Column + 6).Value = Cel.Value
Next Cel
Cells(1, 6) = "A et B"
Cells(1, 7) = "A"
Cells(1, 8) = "B"
Columns(1).AutoFit
Columns(2).AutoFit
Columns(3).AutoFit
Columns(4).AutoFit
Columns(5).AutoFit
Columns(6).AutoFit
Columns(7).AutoFit
Columns(8).AutoFit
End Sub |
Partager