Listo, te anexo el código para pasar los datos capturados al listbox
Private Sub CommandButton1_Click()
'Por.Dante Amor
Set h2 = Sheets("temp")
u = h2.Range("A" & Rows.Count).End(xlUp).Row + 1
h2.Cells(u, "A") = TextBox1
h2.Cells(u, "B") = TextBox2
h2.Cells(u, "C") = TextBox3
h2.Cells(u, "D") = TextBox4
h2.Cells(u, "E") = TextBox5
h2.Cells(u, "F") = TextBox6
h2.Cells(u, "G") = TextBox7
cargarlist
TextBox2 = ""
limpiar
End Sub
Private Sub TextBox2_Change()
'Por.Dante Amor
limpiar
Set h2 = Sheets("Hoja2")
Set h3 = Sheets("BASE DE DATOS")
Set b = h2.Columns("A").Find(TextBox2, lookat:=xlWhole)
If Not b Is Nothing Then
fila = b.Row
TextBox3 = h2.Cells(fila, "C")
TextBox4 = h2.Cells(fila, "D")
TextBox5 = h2.Cells(fila, "E")
Set c = h3.Columns("B").Find(TextBox5, lookat:=xlWhole)
If Not c Is Nothing Then
f2 = c.Row
TextBox6 = h3.Cells(f2, "C")
TextBox7 = h3.Cells(f2, "D")
Else
If MsgBox("No se encuentra el domicilio, Quieres registrarlo", _
vbQuestion & vbYesNo, "DOMICILIO") = vbYes Then
With UserForm2
.codigo = TextBox2
.numsus = TextBox5
.Show
End With
End If
End If
Else
MsgBox "No existe el código de barras en la hoja2", vbExclamation
End If
End Sub
Sub cargarlist()
'Por.Dante Amor
Set h2 = Sheets("temp")
u = h2.Range("A" & Rows.Count).End(xlUp).Row + 1
h2.Cells.EntireColumn.AutoFit
For i = 1 To 7
ancho = ancho & Int(h2.Cells(1, i).Width + 1) & ";"
Next
ListBox1.ColumnWidths = ancho
ListBox1.RowSource = h2.Name & "!A2:G" & u
End Sub
Sub limpiar()
'Por.Dante Amor
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
End Sub
Private Sub UserForm_Activate()
'Por.Dante Amor
TextBox1 = Date
TextBox2.SetFocus
Set h2 = Sheets("temp")
h2.Range(h2.[A2], "G" & Rows.Count).ClearContents
cargarlist
End Sub
Private Sub CommandButton3_Click()
End
End Sub
Saludos.Dante Amor