Código de Visual Basic para Aplicaciones - Registrar información desde ListBox

Requerimientos

Windows, Microsoft Office

1.0
estrellaestrellaestrellaestrellaestrella(1)

Actualizado el 3 de Octubre del 2017 (Publicado el 11 de Agosto del 2017)gráfica de visualizaciones de la versión: 1.0
2.858 visualizaciones desde el 11 de Agosto del 2017
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

ImagenL
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
Option Explicit
Private I As Single
Private A As Single
'Creado por David Garcia
'Contacto djgagarcia@gmail.com
Private Sub CommandButton1_Click()
 
A = ListBox1.ListCount
 
 
    For I = 0 To ListBox1.ListCount - 1
 
        If TextBox1.Text = ListBox1.List(I, 0) Then
 
            MsgBox "EL ITEM SE ENCUENTRA EN LA LISTA.", vbCritical, "ERROR"
            Exit Sub
 
        End If
 
    Next I
 
    ListBox1.AddItem
    ListBox1.List(A, 0) = TextBox1
    ListBox1.List(A, 1) = TextBox2
    ListBox1.List(A, 2) = TextBox3
    Limpiar
    MsgBox ListBox1.ListCount
 
End Sub
Sub Limpiar()
 
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    ListBox1.ListIndex = -1
    TextBox1.SetFocus
End Sub
Private Sub CommandButton2_Click()
    If ListBox1.ListIndex = -1 Then: Exit Sub
 
    ListBox1.List(ListBox1.ListIndex, 2) = TextBox3
    Limpiar
End Sub
Private Sub CommandButton3_Click()
 
    If ListBox1.ListIndex = -1 Then: Exit Sub
 
    ListBox1.RemoveItem ListBox1.ListIndex
    Limpiar
 
End Sub
Private Sub CommandButton4_Click()
Dim I As Integer
Dim Uf As Long
 
With Hoja1
 
    Uf = .Range("A" & Rows.Count).End(xlUp).Row + 1
 
    For I = 0 To ListBox1.ListCount - 1
 
        .Range("A" & Uf) = ListBox1.List(I, 0) 'Columna 1
        .Range("B" & Uf) = ListBox1.List(I, 1) 'Columna 2
        .Range("C" & Uf) = ListBox1.List(I, 2) 'Columna 3
 
 
    Uf = Uf + 1
 
    Next I
 
 
End With
    ListBox1.Clear
 
End Sub
Private Sub CommandButton5_Click()
    Unload Me
End Sub
Private Sub ListBox1_Click()
 
    TextBox1.Text = ListBox1.List(ListBox1.ListIndex, 0)
    TextBox2.Text = ListBox1.List(ListBox1.ListIndex, 1)
    TextBox3.Text = ListBox1.List(ListBox1.ListIndex, 2)
 
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
 
    Limpiar
 
End Sub



Comentarios sobre la versión: 1.0 (1)

Omar
1 de Noviembre del 2021
estrellaestrellaestrellaestrellaestrella
No ha dejado ningún comentario
Responder

Comentar la versión: 1.0

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s4105