H o l a:
Te anexo las actualizaciones.
En el userform1:
'Abrir el formulario para modificar
Private Sub CommandButton3_Click()
'Por.Dante Amor
If ListBox1.ListCount = 0 Then
MsgBox "No existen registros a modificar"
Exit Sub
End If
If ListBox1.ListIndex = -1 Then
MsgBox "Selecciona un registro de listbox"
Exit Sub
End If
'
col = ListBox1.ColumnCount
fila = ListBox1.List(ListBox1.ListIndex, col)
UserForm1.Hide
With UserForm2
.f = fila
.m = True
.Show
End With
End Sub
'
'Eliminar el registro
Private Sub CommandButton4_Click()
End Sub
'
'Mostrar resultado en ListBox
Private Sub CommandButton5_Click()
End Sub
'Activar la celda del registro elegido
Private Sub ListBox1_Click()
End Sub
'
Private Sub txtFiltro1_Change()
'Por.Dante Amor
Set h1 = Sheets("JULIO")
Set h2 = Sheets("TEMP")
h2.Cells.Clear
ListBox1.RowSource = ""
h1.Rows(8).Copy h2.Rows(1)
j = 2
u = h1.Range("B" & Rows.Count).End(xlUp).Row
Set r = h1.Range("B9:G" & u)
Set b = r.Find(txtFiltro1, lookat:=xlPart)
If Not b Is Nothing Then
ncell = b.Address
Do
'detalle
h1.Rows(b.Row).Copy h2.Rows(j)
h2.Cells(j, "H") = b.Row
j = j + 1
Set b = r.FindNext(b)
Loop While Not b Is Nothing And b.Address <> ncell
End If
u2 = h2.Range("B" & Rows.Count).End(xlUp).Row
If u2 > 1 Then
h2.Columns("B:G").EntireColumn.AutoFit
For i = 2 To Columns("G").Column
cad = cad & Int(h2.Cells(1, i).Width) + 3 & " pt;"
Next
ListBox1.ColumnWidths = cad
ListBox1.RowSource = h2.Name & "!B2:H" & u2
End If
End Sub
'
'Dar formato al ListBox y traer datos de la tabla
Private Sub UserForm_Initialize()
'Por.Dante Amor
With ListBox1
.ColumnCount = 6
.ColumnHeads = True
End With
End Sub
'
'Cerrar formulario
Private Sub CommandButton2_Click()
Unload Me
End Sub
en el userform2
Public f As Integer
Public m As Boolean
'
Private Sub CommandButton2_Click()
'Por.Dante Amor
UserForm3.LabelFecha = txtFecha
UserForm3.LabelDocumento = txtDocumento
UserForm3.LabelDescripcion = txtDescripcion
UserForm3.LabelProveedor = txtProveedor
UserForm3.LabelClasificacion = cmClasificacion
UserForm3.LabelMonto = txtMonto
Unload UserForm2
UserForm3.Show
End Sub
'
Private Sub UserForm_Activate()
'Por.Dante Amor
If m Then
txtFecha = Cells(f, "B")
txtDocumento = Cells(f, "C")
txtDescripcion = Cells(f, "D")
txtProveedor = Cells(f, "E")
cmClasificacion = Cells(f, "F")
txtMonto = Cells(f, "G")
End If
End Sub
'
Private Sub CommandButton3_Click()
Unload Me
End Sub
en el userform3
Private Sub Atras_Click()
'Act.Por.Dante Amor
UserForm2.txtFecha = LabelFecha
UserForm2.txtDocumento = LabelDocumento
UserForm2.txtDescripcion = LabelDescripcion
UserForm2.txtProveedor = LabelProveedor
UserForm2.cmClasificacion = LabelClasificacion
UserForm2.txtMonto = LabelMonto
Unload UserForm3
With UserForm2
.m = False
.Show
End With
End Sub
'
Private Sub Cancelar_Click()
Unload Me
End Sub
':)
'S aludos. D a n t e A m o r . R ecuerda valorar la respuesta. G racias
':)