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
| Sub macro1()
Dim ligne As String
Dim ligne1 As String
Dim col As String
ligne = 7
ligne1 = 5
col = 2
'Do While Cells(ligne1, col + 2) <> "23"
Do While Cells(ligne, 3) <> "15"
If Cells(ligne, 3) = "1" Then
With Cells(ligne, col + 3)
.Formula = "=VLOOKUP(R3C[-1],'feuille inventaire'!R3C1:r100c4,4,FALSE)"
.Value = .Value
End With
Cells(ligne, col + 5) = Cells(ligne, col + 2) + Cells(ligne, col + 3) - Cells(ligne, col + 4)
Else
If Cells(ligne, 3) > "1" Then
Cells(ligne, col + 3) = Cells(ligne - 1, col + 5)
Cells(ligne, col + 5) = Cells(ligne, col + 2) + Cells(ligne, col + 3) - Cells(ligne, col + 4)
End If
End If
ligne = ligne + 1
Loop
'col = col + 4
'Loop
End Sub |
Partager