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
| Dim DerLig_f1_f1 As Long, DerLig_f2 As Long
Dim f1 As Worksheet, f2 As Worksheet
Sub Listes()
Application.ScreenUpdating = False
Set f1 = Sheets("Listes")
DerLig_f1 = f1.Range("A" & Rows.Count).End(xlUp).Row
'Suppression des zones de noms existantes
ActiveWorkbook.Names("Code_EAN").Delete
ActiveWorkbook.Names("Code_ID").Delete
ActiveWorkbook.Names("Articles").Delete
'Création des nouvelles zones de noms
ActiveWorkbook.Names.Add Name:="Code_EAN", RefersToR1C1:="=Listes!R2C1:R" & DerLig_f1 & "C1"
ActiveWorkbook.Names.Add Name:="Code_ID", RefersToR1C1:="=Listes!R2C3:R" & DerLig_f1 & "C3"
ActiveWorkbook.Names.Add Name:="Articles", RefersToR1C1:="=Listes!R2C2:R" & DerLig_f1 & "C2"
'Création de la liste déroulante(validation de données)
With f1.Range("F22:G22").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Articles"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = False
End With
Set f1 = Nothing
End Sub
Sub Commandes()
Application.ScreenUpdating = False
Set f1 = Sheets("Listes")
Set f2 = Sheets("Commandes")
DerLig_f2 = f2.Range("A" & Rows.Count).End(xlUp).Row + 1
'Qte = InputBox("Indiquez la quantité à commander", "Commande articles")
Article = f1.Range("F22")
Code_EAN = f1.Range("G23")
Code_ID = f1.Range("G24")
'Position = f1.Range("G25")
f2.Range(f2.Cells(DerLig_f2, "A"), f2.Cells(DerLig_f2, "C")) = Array(Code_EAN, Article, Code_ID)
Set f1 = Nothing
Set f2 = Nothing
End Sub |
Partager