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
| Sub Organisation_nomenclature_solid()
'Range OP
Dim Cell As Range
Dim Matiere As String
Dim Epaisseur As String
Dim Nb_op As Long
Dim Listing As Long
Dim Table_op
'fin matiere
Set Cell = Range("a2") ' Cellule de démarrage
Do While Cell.Value <> ""
'Matiere
Matiere = Cell(1, 6)
Epaisseur = Cell(1, 7)
If Not (Matiere Like "Matériau <non spécifié>") And Epaisseur Like ("Epaisseur@*") Then
Cell(1, 5) = Matiere
ElseIf Not (Matiere Like "Matériau <non spécifié>") And Not (Epaisseur Like "Epaisseur@*") Then
Cell(1, 5) = Matiere & " " & Epaisseur
End If
'fin matiere
Table_op = Split(Cell(1, 3), ";") ' On récupère en tableau les données de la troisième colonne
Listing = UBound(Table_op) + 1
If Listing <> 1 Then
Cell(2).Resize(Listing - 1).EntireRow.Insert shift:=xlUp 'On insère les lignes pour ajouter les données
Cell(1, 3) = Table_op(0) ' On nettoie la première ligne pour qu'elle retienne la première valeur du tableau
For Nb_op = 2 To Listing ' On boucle sur le tableau des données récupérées dans la troisième colonne
Cell(Nb_op, 1).Value = Cell.Value
Cell(Nb_op, 2).Value = Cell(1, 2).Value
Cell(Nb_op, 3).Value = Table_op(Nb_op - 1)
Cell(Nb_op, 5).Value = Cell(1, 5).Value
Next Nb_op
End If
Set Cell = Cell.Offset(Listing) ' On saute à la cellule non traitée suivante
Loop
'RefERRIC
Dim Espace As Object
Dim Ctr
Dim NombreCellule As Integer
Set Espace = Range("C1").CurrentRegion
NombreCellule = Espace.Count
For Ctr = 1 To NombreCellule
If Espace(Ctr) Like ("*Découpe*") Then
Espace(Ctr).Offset(0, 1) = "ERRIC Découpe"
ElseIf Espace(Ctr) Like ("*Pliage*") Then
Espace(Ctr).Offset(0, 1) = "ERRIC Découpe"
ElseIf Espace(Ctr) Like ("*Serrurerie*") Then
Espace(Ctr).Offset(0, 1) = "ERRIC Serrurerie"
ElseIf Espace(Ctr) Like ("*Mécanique*") Then
Espace(Ctr).Offset(0, 1) = "ERRIC Mécanique"
End If
Next
Columns("F:G").Delete shift:=xlToLeft
End Sub |
Partager