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
|
Sub deplacedonne(wsSource As Worksheet, wsDest As Worksheet, colonne As Integer, ByVal nbCol As Integer, colonnedest As Integer, choix, lastligne As Long, del_col1, del_col2)
Dim SourceLine
Dim type_ref
Dim destline As Long
Dim nbcount
nbcount = Cherche(Sheets("Fichier à renseigner"), 1, ("a5"), Sheets("paramétre"), "1")
Dim lettre
lettre = Cherche(Sheets("Fichier à renseigner"), 1, ("a5"), Sheets("paramétre"), "2")
Dim Désignation
Désignation = Cherche(Sheets("Fichier à renseigner"), 2, ("b5"), Sheets("bdd"), "1")
Dim poid
poid = Cherche(Sheets("Fichier à renseigner"), 2, ("b5"), Sheets("bdd"), "2")
Dim i
destline = lastligne + 1
For i = 1 To nbcount Step 1
With wsSource.Cells(5, colonne).Resize(1, nbCol)
.Copy wsDest.Cells(destline, colonnedest)
nbCol = IIf(nbCol >= Columns.Count, Columns.Count - 1, nbCol)
wsDest.Cells(destline, 3) = wsDest.Cells(destline, 2) + lettre
wsDest.Cells(destline, 4) = wsDest.Cells(destline, 3) & "/" & i
wsDest.Cells(destline, 6) = Désignation
wsDest.Cells(destline, 7) = poid
destline = destline + 1
End With
Next i
End Sub |
Partager