Visual Basic - INGRESO DE VARIOS ITEMS CON COMBOBOX Y FORMULARIOS

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil
Val: 6
Ha aumentado su posición en 12 puestos en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

INGRESO DE VARIOS ITEMS CON COMBOBOX Y FORMULARIOS

Publicado por JUAN (11 intervenciones) el 14/11/2015 17:36:48
Buenos dias estimados Señores de la comunidad, estoy aprendiendo a elaborar mis primeros pasos en programación y quisiese me apoyen con sus sabios conocimientos.

Estoy elaborando un control de entradas con formularios y combobox, pero tengo problemas al momento de grabar el segundo item y que grave los mismos datos de la fecha, el proveedor y el numero de comprobante, cuando ejecuto la macro me reemplaza el mismo tercer lugar de la posicion y no graba en forma ordenada.

Espero me puedan apoyar

detallo las macros utilizadas y adjunto el archivo elaborado

PARA EL FORMULARIO 02

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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
Private Sub ComboBox1_Click()
Dim i As Integer
Dim j As Integer
Dim final As Integer
Dim FINAL2 As Integer
 
For i = 2 To 1000
If Hoja3.Cells(i, 1) = "" Then
final = i - 1
Exit For
End If
Next
 
For i = 2 To 1000
If Hoja2.Cells(i, 1) = "" Then
FINAL2 = i - 1
Exit For
End If
Next
 
For i = 2 To final
If ComboBox1 = Hoja3.Cells(i, 1) Then
TextBox1 = Hoja3.Cells(i, 2)
Exit For
End If
Next
 
For j = 1 To FINAL2
If ComboBox1 = Hoja2.Cells(j, 1) Then
TextBox8 = Hoja2.Cells(j, 3)
Exit For
End If
Next
 
End Sub
 
Private Sub ComboBox2_Click()
Dim i As Integer
Dim j As Integer
Dim final As Integer
Dim FINAL2 As Integer
 
For i = 2 To 1000
If Hoja3.Cells(i, 2) = "" Then
final = i - 1
Exit For
End If
Next
 
For i = 2 To 1000
If Hoja2.Cells(i, 2) = "" Then
FINAL2 = i - 1
Exit For
End If
Next
 
For i = 2 To final
If ComboBox2 = Hoja3.Cells(i, 1) Then
TextBox11 = Hoja3.Cells(i, 2)
Exit For
End If
Next
 
For j = 1 To FINAL2
If ComboBox2 = Hoja2.Cells(j, 1) Then
TextBox16 = Hoja2.Cells(j, 3)
Exit For
End If
Next
 
End Sub
 
Private Sub ComboBox1_Enter()
Dim i As Integer
Dim j As Integer
Dim H As Integer
Dim final As Integer
Dim tareas As String
 
ComboBox1.BackColor = &H80000005
 
For i = 1 To ComboBox1.ListCount
 
               ComboBox1.RemoveItem 0
 
           Next i
 
For j = 2 To 1000
If Hoja3.Cells(j, 1) = "" Then
final = j - 1
Exit For
End If
Next
 
 
For H = 2 To final
tareas = Hoja3.Cells(H, 1)
ComboBox1.AddItem (tareas)
Next
 
'End If
 
End Sub
 
Private Sub ComboBox2_Enter()
Dim i As Integer
Dim j As Integer
Dim H As Integer
Dim final As Integer
Dim tareas As String
 
ComboBox2.BackColor = &H80000005
 
For i = 1 To ComboBox2.ListCount
 
               ComboBox2.RemoveItem 0
 
           Next i
 
For j = 2 To 1000
If Hoja3.Cells(j, 1) = "" Then
final = j - 1
Exit For
End If
Next
 
 
For H = 2 To final
tareas = Hoja3.Cells(H, 1)
ComboBox2.AddItem (tareas)
Next
End Sub
 
 
Private Sub CommandButton1_Click()
Dim validar As Boolean
Dim validarfecha As Boolean
 
If TextBox1 = "" Then
UserForm10.Show
Exit Sub
End If
 
If TextBox11 = "" Then
UserForm10.Show
Exit Sub
End If
 
If TextBox2 = "" Then
UserForm11.Show
Exit Sub
End If
 
If TextBox15 = "" Then
UserForm11.Show
Exit Sub
End If
 
If TextBox4 = "" Then
UserForm12.Show
Exit Sub
End If
 
If TextBox6 = "" Then
UserForm13.Show
Exit Sub
End If
 
If TextBox7 = "" Then
UserForm14.Show
Exit Sub
End If
 
validar = IsNumeric(TextBox2.Value)
If validar = False Then
UserForm22.Show
TextBox2.BackColor = &HFF00&
Exit Sub
End If
 
validar = IsNumeric(TextBox15.Value)
If validar = False Then
UserForm22.Show
TextBox15.BackColor = &HFF00&
Exit Sub
End If
 
validarfecha = IsDate(TextBox6.Value)
If validarfecha = False Then
UserForm23.Show
TextBox6.BackColor = &HFF00&
Exit Sub
End If
 
If TextBox2 <> "" And TextBox1 <> "" And TextBox4 <> "" And TextBox6 <> "" And TextBox7 <> "" Then
TextBox2.BackColor = -2147483643
TextBox6.BackColor = -2147483643
UserForm15.Show
End If
 
If TextBox15 <> "" And TextBox11 <> "" And TextBox4 <> "" And TextBox6 <> "" And TextBox7 <> "" Then
TextBox15.BackColor = -2147483643
TextBox6.BackColor = -2147483643
UserForm15.Show
End If
 
End Sub
 
Private Sub CommandButton2_Click()
UserForm2.Hide
End Sub
 
PARA EL FORMULARIO 15
 
Private Sub CommandButton1_Click()
Dim i As Integer
Dim j As Integer
Dim final As Integer
Dim actual As Integer
 
For i = 1 To 1000
If Hoja2.Cells(i, 1) = "" Then
final = i
Exit For
End If
Next
 
Hoja1.Cells(final, 1) = UserForm2.ComboBox1
Hoja1.Cells(final, 2) = UserForm2.TextBox1
Hoja1.Cells(final, 3) = UserForm2.TextBox2
Hoja1.Cells(final, 4) = UserForm2.TextBox4
Hoja1.Cells(final, 5) = UserForm2.TextBox6
Hoja1.Cells(final, 6) = UserForm2.TextBox7
 
For j = 1 To 1000
If Hoja2.Cells(j, 1) = Hoja1.Cells(final, 1) Then
actual = Hoja2.Cells(j, 3)
final = UserForm2.TextBox2 + actual
Hoja2.Cells(j, 3) = final
Exit For
End If
Next
 
UserForm2.ComboBox1 = ""
UserForm2.TextBox1 = ""
UserForm2.TextBox2 = ""
UserForm2.TextBox4 = ""
UserForm2.TextBox6 = ""
UserForm2.TextBox7 = ""
UserForm2.TextBox8 = ""
 
UserForm15.Hide
UserForm2.Hide
 
End Sub
 
Private Sub CommandButton2_Click()
UserForm15.Hide
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 6
Ha aumentado su posición en 12 puestos en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

INGRESO DE VARIOS ITEMS CON COMBOBOX Y FORMULARIOS

Publicado por JUAN (11 intervenciones) el 16/11/2015 15:52:18
Buen dia, disculpe si no lo he planteado en un foro de VBA, porque no conozco bien aun los diferentes foros existentes, hace poco plantee una pregunta en este foro y me la respondieron, pense que esta vez seria similar.

Gracias, por su aporte.

Juan
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar