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
| Option Explicit
Sub Normalisation()
Dim lignecourante As Long
Dim matierecourante As Long
Dim packagingcourant As Long
Dim classecourante As Long
Dim feuillesrc As String, feuillecbl As String
Dim lignecbl As Long, colonnecbl As Long
feuillesrc = "Feuil1"
feuillecbl = "Feuil2"
lignecbl = 2
colonnecbl = 1
lignecourante = 2
Do While IsEmpty(Worksheets(feuillesrc).Cells(lignecourante, 1)) = False
For matierecourante = 3 To 5
If Not IsEmpty(Worksheets(feuillesrc).Cells(lignecourante, matierecourante)) Then
For packagingcourant = 6 To 7
If Not IsEmpty(Worksheets(feuillesrc).Cells(lignecourante, packagingcourant)) Then
For classecourante = 8 To 9
If Not IsEmpty(Worksheets(feuillesrc).Cells(lignecourante, classecourante)) Then
colonnecbl = 1
Worksheets(feuillecbl).Cells(lignecbl, colonnecbl).Value = Worksheets(feuillesrc).Cells(lignecourante, 1)
colonnecbl = colonnecbl + 1
Worksheets(feuillecbl).Cells(lignecbl, colonnecbl).Value = Worksheets(feuillesrc).Cells(lignecourante, 2)
colonnecbl = colonnecbl + 1
Worksheets(feuillecbl).Cells(lignecbl, colonnecbl).Value = Worksheets(feuillesrc).Cells(lignecourante, matierecourante)
colonnecbl = colonnecbl + 1
Worksheets(feuillecbl).Cells(lignecbl, colonnecbl).Value = Worksheets(feuillesrc).Cells(lignecourante, packagingcourant)
colonnecbl = colonnecbl + 1
Worksheets(feuillecbl).Cells(lignecbl, colonnecbl).Value = Worksheets(feuillesrc).Cells(lignecourante, classecourante)
lignecbl = lignecbl + 1
Else
Exit For
End If
Next
Else
Exit For
End If
Next
Else
Exit For
End If
Next
lignecourante = lignecourante + 1
Loop
End Sub |
Partager