Visual Basic para Aplicaciones - Error en boton,formulario excel

Life is soft - evento anual de software empresarial
 
Vista:

Error en boton,formulario excel

Publicado por Pato (1 intervención) el 17/01/2020 09:04:19
Hola,tengo un error y no entiendo muy bien por que me aparece ,me aparece el error de uso de la propiedad no es valido. adjunto la parte del código en la cual tengo error,también se me hace super raro el error por que lo hice siguiendo un tutorial de youtube (solo que con diferentes valores) mdifique el tutorial a mis necesidades .espero me puedan ayudar


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
Private Sub CommandButton1_Click()
 
Dim xfill As Integer
 
Range ("B4")
xfill = ActiveCell.CurrentRegion.Rows.Count
ActiveCell.Offset(xfill, 1) = ComboBox5.Text
ActiveCell.Offset(xfill, 2) = ComboBox1.Text
ActiveCell.Offset(xfill, 3) = aut.Text
ActiveCell.Offset(xfill, 4) = ampli.Text
ActiveCell.Offset(xfill, 5) = redu.Text
 
If ComboBox3.ListIndex = 0 Then
ActiveCell.Offset(xfill, 7) = req.Text
ActiveCell.Offset(xfill, 8) = rad.Text
ActiveCell.Offset(xfill, 9) = con.Text
ActiveCell.Offset(xfill, 10) = iva.Text
ActiveCell.Offset(xfill, 11) = sin.Text
 
End If
 
If ComboBox3.ListIndex = 1 Then
ActiveCell.Offset(xfill, 12) = req.Text
ActiveCell.Offset(xfill, 13) = rad.Text
ActiveCell.Offset(xfill, 14) = con.Text
ActiveCell.Offset(xfill, 15) = iva.Text
ActiveCell.Offset(xfill, 16) = sin.Text
 
End If
If ComboBox3.ListIndex = 2 Then
ActiveCell.Offset(xfill, 17) = req.Text
ActiveCell.Offset(xfill, 18) = rad.Text
ActiveCell.Offset(xfill, 19) = con.Text
ActiveCell.Offset(xfill, 20) = iva.Text
ActiveCell.Offset(xfill, 21) = sin.Text
 
End If
If ComboBox3.ListIndex = 3 Then
ActiveCell.Offset(xfill, 22) = req.Text
ActiveCell.Offset(xfill, 23) = rad.Text
ActiveCell.Offset(xfill, 24) = con.Text
ActiveCell.Offset(xfill, 25) = iva.Text
ActiveCell.Offset(xfill, 26) = sin.Text
 
End If
 
 
 
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
Imágen de perfil de Antoni Masana
Val: 1.134
Oro
Ha mantenido su posición en Visual Basic para Aplicaciones (en relación al último mes)
Gráfica de Visual Basic para Aplicaciones

Error en boton,formulario excel

Publicado por Antoni Masana (498 intervenciones) el 20/01/2020 16:25:26
Sin ver el libro es imposible saber que es lo que esta fallando.

Por otro lado creo que te has liado com el comando offset.

Así a groso modo te puedo decir que el comando OFFSET es para desplazarse, y para desplazarse hay que estar posicionado en una celda, es como si dijeses la población tal esta a 100 km al norte. ¿Al norte de donde? de Barcelona, de Madrid, de Bilbao, si fuese esta última estaría bajo el mar. Por si no lo has notado soy de España pero no viene al caso.

Por otro lado su tu celda de referencia es la fila 10, columna 1 el resultado de tu primera líneas de asignación suponiendo que xFill tenga un valor de 10 seria:

1
2
3
4
5
ActiveCell.Offset(xfill, 1) = ComboBox5.Text     ' Fila 20 - Columna 2  ==>  B20
ActiveCell.Offset(xfill, 2) = ComboBox1.Text     ' Fila 30 - Columna 3  ==>  C30
ActiveCell.Offset(xfill, 3) = aut.Text           ' Fila 40 - Columna 4  ==>  D40
ActiveCell.Offset(xfill, 4) = ampli.Text         ' Fila 50 - Columna 5  ==>  E50
ActiveCell.Offset(xfill, 5) = redu.Text          ' Fila 60 - Columna 6  ==>  F60

Como no se que hace, que quieres hacer y donde lo hace, poco más te puedo decir.

Saludos.
\\//_
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