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
| Sub ImportPrice()
Dim wsB As Worksheet
Dim wsJ As Worksheet
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim nbre As Double
Dim Cellule As Variant
Set wsB = ThisWorkbook.Worksheets("Data")
Set wsJ = ThisWorkbook.Worksheets("Price")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''Nombre de prix''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
nbre = wsJ.Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To nbre
wsJ.Cells(2, i).FormulaR1C1 = "=COUNTIF(prix,Price!R[-1]C)"
Next i
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''Prix par valeur''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 1 To nbre
For j = 3 To wsJ.Cells(2, i).Value
For Each Cellule In wsB.Range("prix")<== ici le range va de B2:B65536
If Cellule.Value = wsJ.Cells(1, i).Value Then
wsJ.Cells(, i).Value = Cellule.Offset(0, 1).Value
End If
Next Cellule
Next j
Next i
End Sub |
Partager