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
|
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 nbre2 As Double
Dim CB 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
nbre2 = wsB.Cells(Rows.Count, 1).End(xlUp).Row
CB = nbre2
For i = 1 To nbre
wsJ.Cells(2, i).FormulaR1C1 = "=COUNTIF(prix,Price!R[-1]C)"
Next i
'''''''''''''''''''Numéro des ligne""""""""""""""""
wsJ.Cells(3, 1).Value = 2
wsJ.Cells(4, 1).Value = wsJ.Cells(2, 1).Value + 1
For i = 2 To nbre
Cells(4, i).Value = Cells(4, i - 1).Value + Cells(2, i).Value
Next i
For i = 2 To nbre
wsJ.Cells(3, i).Value = wsJ.Cells(4, i - 1).Value + 1
Next i
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''Prix par valeur''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 1 To nbre
For j = 6 To wsJ.Cells(2, i).Value
For k = wsJ.Cells(3, i).Value To wsJ.Cells(4, i).Value
If wsB.Cells(k, 2).Value = wsJ.Cells(1, i).Value Then
wsJ.Cells(j, i).Value = wsB.Cells(k, 3).Value
End If
Next k
Next j
Next i
"""""""""""""""""""""un autre idée qui a marché uniquement pour la premiere colonne"""""""""""""""
'wsJ.Cells(j, i).FormulaR1C1 = "=IF(data!R[-1]C[1]=Price!R1C,data!R[-1]C[2],"""")"
End Sub |
Partager