
Problemas con código en formulario
Publicado por Nestor Hernandez (2 intervenciones) el 17/12/2017 06:30:09
Buenas noches estimados de este foro un gusto saludarlos, necesito ayuda en un código que tengo, resulta que tengo un formulario en Excel que contiene varios TextBox en los de la izquierda necesito colocar un valor Ejemplo (46), en los de la derecha pongo el numero de veces que quiero que se repita el primero, ya me funciona el código pero el problema que solamente en los primeros TextBox en el resto no se como hacer que funcionen al presionar el Boton que he llamado "INSERTAR".
Podrían ayudarme, dejo el código:
Podrían ayudarme, dejo el código:
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
Private Sub CommandButton1_Click()
'definimos las variables
Dim iFila As Long
Dim contador As Long
Dim ws As Worksheet
Set ws = Worksheets(1)
' Encuentra la siguiente fila vacía
iFila = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
' Verifica que se ingrese un nombre
If Trim(Me.TextBox2.Value) = "" Then
Me.TextBox2.SetFocus
MsgBox "Debe ingresar un nombre"
Exit Sub
End If
For contador = 1 To Val(TextBox2)
ws.Cells(iFila, contador).Value = Val(TextBox1)
Next contador
End Sub
Private Sub CommandButton2_Click()
TextBox1 = Empty
TextBox2 = Empty
TextBox3 = Empty
TextBox4 = Empty
TextBox5 = Empty
TextBox6 = Empty
TextBox7 = Empty
TextBox8 = Empty
TextBox9 = Empty
TextBox20 = Empty
TextBox11 = Empty
TextBox12 = Empty
TextBox13 = Empty
TextBox14 = Empty
TextBox15 = Empty
TextBox16 = Empty
TextBox17 = Empty
TextBox18 = Empty
TextBox19 = Empty
TextBox20 = Empty
TextBox21 = Empty
TextBox22 = Empty
TextBox23 = Empty
TextBox24 = Empty
TextBox25 = Empty
TextBox26 = Empty
TextBox27 = Empty
TextBox28 = Empty
TextBox29 = Empty
TextBox30 = Empty
TextBox31 = Empty
TextBox32 = Empty
TextBox33 = Empty
TextBox34 = Empty
TextBox35 = Empty
TextBox36 = Empty
TextBox37 = Empty
TextBox38 = Empty
TextBox39 = Empty
TextBox40 = Empty
TextBox1.SetFocus
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Valora esta pregunta


0