Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
Private Sub enregistrerbonentree_Click()
 Sheets("ENTREE").Activate
 Sheets("ENTREE1").Activate
Dim Xls, Xls1 As Worksheet, lLig, lLig1 As Long
    Set Xls = ThisWorkbook.Worksheets("ENTREE")
    Set Xls1 = ThisWorkbook.Worksheets("ENTREE1")
    'Recherche la ligne disponible
    lLig = 7
    lLig1 = 2
   
   While Xls.Cells(lLig, 1) <> "" And Xls1.Cells(lLig1, 1) <> ""
        lLig = lLig + 1
        lLig1 = lLig1 + 1
   Wend
Xls1.Cells(lLig1, 1) = jour.Value
     Xls1.Cells(lLig1, 2) = bldefab.Value
     Xls1.Cells(lLig1, 4) = pdstotal.Value
   Xls1.Cells(lLig1, 3) = TextBox266.Value
   Xls.Cells(lLig, 1) = jour.Value
   Xls1.Cells(lLig1, 5) = ComboBox12.Value
   Xls1.Cells(lLig1, 6) = TextBox868.Value
   Xls1.Cells(lLig1, 7) = TextBox854.Value
   Xls1.Cells(lLig1, 5) = ComboBox14.Value
   Xls1.Cells(lLig1, 6) = TextBox867.Value
   Xls1.Cells(lLig1, 7) = TextBox853.Value   
:help::help:Xls.Cells(lLig, 2) = bsd.Value
    Xls.Cells(lLig, 3) = bldefab.Value
     Xls.Cells(lLig, 4) = bltransp.Value
    ' Aiguillage selon la nature
  LaListe = Array("Cartes", "Cartes de paiement", "cartes riches", "claviers", _
"composants electro", "compteurs", "contacteurs/disjonct", "copieur", _
"deee", "disques durs", "écrans crt", "écrans tft", "electro portatif", _
"encre & toner", "imprimante", "manettes de jeux", "non valorisable", _
"onduleur", "papier", "papier sensible", "pc portable", "pe-ld", _
"piles alcalines", "serveur", "traceur", "tubes d'écrans", "tubes fluo", "uc")


pos = Application.Match(ComboBox12, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox868.Value
Xls.Cells(lLig, colonne2) = TextBox854.Value
pos = Application.Match(ComboBox14, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox867.Value
Xls.Cells(lLig, colonne2) = TextBox853.Value
pos = Application.Match(ComboBox15, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox866.Value
Xls.Cells(lLig, colonne2) = TextBox849.Value
pos = Application.Match(ComboBox13, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox865.Value
Xls.Cells(lLig, colonne2) = TextBox824.Value
pos = Application.Match(ComboBox38, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox864.Value
Xls.Cells(lLig, colonne2) = TextBox823.Value
pos = Application.Match(ComboBox37, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox863.Value
Xls.Cells(lLig, colonne2) = TextBox822.Value
pos = Application.Match(ComboBox36, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox862.Value
Xls.Cells(lLig, colonne2) = TextBox821.Value
pos = Application.Match(ComboBox35, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox861.Value
Xls.Cells(lLig, colonne2) = TextBox820.Value
pos = Application.Match(ComboBox34, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox860.Value
Xls.Cells(lLig, colonne2) = TextBox819.Value
pos = Application.Match(ComboBox33, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox859.Value
Xls.Cells(lLig, colonne2) = TextBox818.Value
pos = Application.Match(ComboBox32, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox858.Value
Xls.Cells(lLig, colonne2) = TextBox817.Value
pos = Application.Match(ComboBox31, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox857.Value
Xls.Cells(lLig, colonne2) = TextBox816.Value
pos = Application.Match(ComboBox30, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox856.Value
Xls.Cells(lLig, colonne2) = TextBox815.Value
pos = Application.Match(ComboBox29, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox855.Value
Xls.Cells(lLig, colonne2) = TextBox814.Value
pos = Application.Match(ComboBox23, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox852.Value
Xls.Cells(lLig, colonne2) = TextBox813.Value
pos = Application.Match(ComboBox25, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox851.Value
Xls.Cells(lLig, colonne2) = TextBox848.Value
pos = Application.Match(ComboBox28, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox850.Value
Xls.Cells(lLig, colonne2) = TextBox847.Value
pos = Application.Match(ComboBox17, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox835.Value
Xls.Cells(lLig, colonne2) = TextBox846.Value
pos = Application.Match(ComboBox16, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox834.Value
Xls.Cells(lLig, colonne2) = TextBox845.Value
pos = Application.Match(ComboBox18, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox833.Value
Xls.Cells(lLig, colonne2) = TextBox844.Value
pos = Application.Match(ComboBox19, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox832.Value
Xls.Cells(lLig, colonne2) = TextBox843.Value
pos = Application.Match(ComboBox39, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox831.Value
Xls.Cells(lLig, colonne2) = TextBox842.Value
pos = Application.Match(ComboBox22, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox830.Value
Xls.Cells(lLig, colonne2) = TextBox841.Value
pos = Application.Match(ComboBox21, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox829.Value
Xls.Cells(lLig, colonne2) = TextBox840.Value
pos = Application.Match(ComboBox26, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox828.Value
Xls.Cells(lLig, colonne2) = TextBox839.Value
pos = Application.Match(ComboBox20, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox827.Value
Xls.Cells(lLig, colonne2) = TextBox838.Value
pos = Application.Match(ComboBox24, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox826.Value
Xls.Cells(lLig, colonne2) = TextBox837.Value
pos = Application.Match(ComboBox27, LaListe, 0)
colonne1 = (pos * 2) + 37 + pos - 1
colonne2 = (pos * 2) + 37 + pos
Xls.Cells(lLig, colonne1) = TextBox825.Value
Xls.Cells(lLig, colonne2) = TextBox836.Value
end sub
J'ai ce code qui marche impeccable pour enregistrer mon bon.
Par contre je suis obligée de remplir tous mes combobox pour que mes données s'inscrivent dans ma feuille excel
Que faut-il que je rajoute pour que par exemple si je ne veux renseigner que 1, 2 ou 3 combobox ca s'enregistre dans mon tableau.

Et j'ai aussi besoin de votre aide pour l'enregistrement dans ma feuille "entrée1" en rouge dans mon code

c'est à dire si je rentre dans mon userform :
15/01/09 15487(bldefab) 10 écrans(combobox12) 154
20 claviers(combobox14)260

que dans mon tableau excel, feuille entrée1, ça soit inscrit

15/01/09 15487 écrans 10 154
15/01/09 154487 claviers 20 260

MERCI POUR VOTRE AIDE qui me serait bien utile pour avancer sur mon fichier car je bloque