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
|
Dim y2 As Integer
Dim y As Integer
Dim a As variant
Dim b As variant
ActiveWorkbook.Worksheets("list").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("list").Sort.SortFields.Add Key:=Range("A:A") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("list").Sort
.SetRange Range("A:D")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
y = 1
y2 = 1
While Sheets("list").Cells(y2, 1) <> "" 'tant que les cellule sont pas vide on boucle
a = Sheets("list").Cells(y2, 1)
While Sheets("appli").Cells(y, 1) <> ""
b = Sheets("appli").Cells(y, 1)
If a = b Then
Sheets("result").Cells(y2, 1) = b
Sheets("result").Cells(y2, 2) = Sheets("appli").Cells(y2, 2)
Sheets("result").Cells(y2, 3) = Sheets("appli").Cells(y2, 3)
Sheets("result").Cells(y2, 4) = Sheets("appli").Cells(y2, 4)
Sheets("result").Cells(y2, 5) = Sheets("appli").Cells(y2, 5)
y2 = y2 + 1
y = 1
GoTo d
End If
y = y + 1
Wend
d:
Wend |
Partager