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
|
Private Sub cmb_ref1_Change()
TraiteChoix
End Sub
Function TraiteChoix()
Dim nbfinal As Variant
Dim libelle As String
Dim reference As String
Dim prix As Single
Dim poids, prixcarton, prixdétail, prixcartonpromo, prixdétailpromo As Double
nbfinal = Right(ActiveControl.Name, 2)
On Error Resume Next
Sheets("source").Select
reference = Controls("cmb_ref" & nbfinal).Text
Cells.Find(What:=reference, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
'faire apparaitre le libéllé
libelle = ActiveCell.Offset(0, 3).Text
Controls("txt_lib" & nbfinal).Text = libelle
'faire apparaitre le poids
poids = ActiveCell.Offset(0, 4).Value
Controls("txt_poids" & nbfinal).Value = poids
'faire apparaitre le poids
poids = ActiveCell.Offset(0, 4).Value
Controls("txt_poids" & nbfinal).Value = poids
'faire apparaitre le prix au carton
prixcarton = ActiveCell.Offset(0, 8).Value
Controls("txt_prix_carton" & nbfinal).Value = prixcarton
'faire apparaitre le prix au détail
prixdétail = ActiveCell.Offset(0, 9).Value
Controls("txt_prix_detailé" & nbfinal).Value = prixdétail
'faire apparaitre le prix au carton promo
prixcartonpromo = ActiveCell.Offset(0, 13).Value
Controls("txt_prixpromo_carton" & nbfinal).Value = prixcartonpromo
'faire apparaitre le prix au détail promo
prixdétailpromo = ActiveCell.Offset(0, 14).Value
Controls("txt_prixpromo_detail" & nbfinal).Value = prixdétailpromo
End Function |
Partager