'Goal : isolate a brand. Then, copy article numbers and their associated product name and paste them in another table'.
'Loop : because we do the same thing all the time'.
1. Sheet "Manuals"
2. Columns "D" to "AU", lines 5 to 40.
3. Go to "Données", filtre.
4. Go to column "Brand" and untick "Select all". 
5. Tick "Branda" (for example) in order to just display "Branda" data.

Then Go to 1st cell "D5"
     
	 ' Case where VALUE is EMPTY '
	 IF value = Empty, then, go to cell "E5".
	 'Each language (FR, AT, BE, etc.) has 2 columns. 
	 'Rule: if cell D5 (for example), under FR, is empty, THEN go to E5, the next FR cell. If this one is empty as well, go to D6, and so on, until you find a cell containing a value. Once the FR cells will be checked, go to the AT cells, and so on.'
	 
	 ' Case where VALUE is FULL '
	 IF cell "D5" = full (or populated with an article number, the rule to recognize an article number is article number = to 10 digits and starts by "002", 
	
	' Copy product name, then article number'
	 THEN copy, under "Product", cell content "A5" and paste it to sheet "database", under "Description", in cell "F3".
	 Go back to sheet "Manuals".
	 AND THEN, copy, under "Installer", content of cell "D5". Paste it to sheet "database", under "Article-no", in cell "D3".

	
AND then, go back to sheet "Manuals", cell "E5".
	 REPEAT steps above for E5. 
	 
THEN go to cell "D6"
	 IF value = Empty, then, go to cell "E6".
	 For each language, as long as a cell is empty, go to the next cell until you find a full cell (containing an article number).
	 
	 IF cell "D6" = full (or populated with a number = to 10 digits and starting with "002"), 
		'case 1'
		AND IF article number in cell D6 = article number from a previous cell.
		'we just copy the product name because we already copied the article number'
		THEN copy, under "Product", cell content "A6". Go to sheet "database", under "Description", in cell "F6". Add a ";" after the "Product" name copied and paste the second "Product name". 
		AND Then, go back to sheet "Manuals", cell "E5".
	 
	 
		'case 2 : normal case, we want to copy-paste article numbers + their product name in another sheet'
		IF cell "D6" = full (or populated with a number = to 10 digits and starting with "002"), 
		THEN, under "Product", copy cell content "A6" and paste it to sheet "database", under "Description", in cell "F3".
		Go back to sheet "Manuals".
		AND Then, under "Installer" column, copy cell content "D6" and paste it to sheet "database", under "Article-no", in cell "D4".	 
		AND Then, go back to sheet "Manuals", cell "E6".
Loop : repeat the same process described from line 21 in this file for each language, then for the other brands. 
		
		
		
Début de ma macro enregistrée en Wysiwyg: 
		
		Sub Tri()
'
' Tri Macro
'
    Selection.AutoFilter
    ActiveSheet.Range("$A$3:$AU$35").AutoFilter Field:=2, Criteria1:="Branda"
    Range("A17").Select
    ActiveCell.FormulaR1C1 = "azertya B 200/5"
    Sheets("Database").Select
    ActiveSheet.PasteSpecial Format:="Texte Unicode", Link:=False, _
        DisplayAsIcon:=False, NoHTMLFormatting:=True
    Range("F3").Select
    ActiveCell.FormulaR1C1 = "azertya B 200/5 ; "
    Sheets("Manuals").Select
    Range("D17").Select
    Selection.Copy
    Sheets("Database").Select
    Range("D3").Select
    ActiveSheet.Paste
    Sheets("Manuals").Select
    Range("E17").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Database").Select
    Range("D4").Select
    ActiveSheet.Paste
    Range("F3").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("F4").Select
    ActiveSheet.Paste
    Sheets("Manuals").Select
    Range("A22").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "azertya B 270/5"
    Sheets("Database").Select
    Range("F3").Select
    ActiveCell.FormulaR1C1 = "azertya B 200/5 ; azertya B 270/5"
    Range("F4").Select
    ActiveCell.FormulaR1C1 = "azertya B 200/5 ; azertya B 270/5"
    Sheets("Manuals").Select
    Range("A28").Select
    Selection.Copy
    Sheets("Database").Select
    Range("F5").Select
    ActiveSheet.Paste
    Range("F5").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "azertya BM 200/5 - 0.8 ; "
    Range("D5").Select
    Sheets("Manuals").Select
    Range("D28").Select
    Selection.Copy
    Sheets("Database").Select
    ActiveSheet.Paste
    Sheets("Manuals").Select
    Range("E28").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Database").Select
    Range("D6").Select
    ActiveSheet.Paste
    Range("F5").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "azertya BM 200/5 - 0.8 ; "
    Range("F6").Select
    ActiveCell.FormulaR1C1 = "azertya BM 200/5 - 0.8 ; "
    Sheets("Manuals").Select
    Range("A33").Select
    ActiveCell.FormulaR1C1 = "azertya BM 270/5 - 0.8"
    Sheets("Database").Select
    Range("F5").Select
    ActiveCell.FormulaR1C1 = "azertya BM 200/5 - 0.8 ; azertya BM 270/5 - 0.8"
    Range("F6").Select
    ActiveCell.FormulaR1C1 = "azertya BM 200/5 - 0.8 ; azertya BM 270/5 - 0.8"
    Sheets("Manuals").Select
    Range("A5").Select
    ActiveCell.FormulaR1C1 = "azertya 80/5"
    Sheets("Database").Select
    Range("F7:F8").Select
    ActiveSheet.PasteSpecial Format:="Texte Unicode", Link:=False, _
        DisplayAsIcon:=False, NoHTMLFormatting:=True
    Range("F8").Select
    ActiveSheet.PasteSpecial Format:="Texte Unicode", Link:=False, _
        DisplayAsIcon:=False, NoHTMLFormatting:=True
    Sheets("Manuals").Select
    Range("F5").Select
    Selection.Copy
    Sheets("Database").Select
    Range("D7").Select
    ActiveSheet.Paste
    Sheets("Manuals").Select
    Range("G5").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Database").Select
    Range("D8").Select
    ActiveSheet.Paste
    Sheets("Manuals").Select
    Range("A8").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "azertya 100/5"
    Sheets("Database").Select
    Range("F7").Select
    ActiveCell.FormulaR1C1 = "azertya 80/5 ; azertya 100/5"
    Range("F8").Select
    ActiveCell.FormulaR1C1 = "azertya 80/5 ; azertya 100/5"
    Range("B38").Select
    Sheets("Manuals").Select
    Range("A33").Select
    ActiveCell.FormulaR1C1 = "azertya BM 270/5 - 0.8"
    Sheets("Database").Select
    Range("F9:F10").Select
    ActiveSheet.PasteSpecial Format:="Texte Unicode", Link:=False, _
        DisplayAsIcon:=False, NoHTMLFormatting:=True
    Range("F10").Select
    ActiveSheet.PasteSpecial Format:="Texte Unicode", Link:=False, _
        DisplayAsIcon:=False, NoHTMLFormatting:=True
    Sheets("Manuals").Select
    Range("F33").Select
    Selection.Copy
    Sheets("Database").Select
    Range("D9").Select
    ActiveSheet.Paste
    Sheets("Manuals").Select
    Range("G33").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Database").Select
    Range("D10").Select
    ActiveSheet.Paste
    Sheets("Manuals").Select
    Range("H5").Select
End Sub
