Ajustar la macro Eliminar registros para que conserve el histórico del Código

Es una pregunta para Dante Amor

Necesitaría una vez tenemos la macro para borrar, eliminar registros poder depurarla, ajustarla para que almacene un histórico del Código.

1 Respuesta

Respuesta
1

H o l a:

Te anexo la macro actualizada

Private Sub CommandButton5_Click()
'Por.Dante Amor
    'Eliminar
    If ListBox1.ListIndex = -1 Then
        MsgBox "Selecciona un registro"
        Exit Sub
    End If
    '
    res = MsgBox("Deseas eliminar el registro", vbQuestion + vbYesNo, "ELIMINAR REGISTRO")
    If res = vbYes Then
        Set h1 = Sheets("TITULOS")
        Set h4 = Sheets("BORRADOS")
        f = ListBox1.List(ListBox1.ListIndex)
        cod = ListBox1.List(ListBox1.ListIndex, 1)
        h1.Rows(f).Delete
        u = h4.Range("A" & Rows.Count).End(xlUp).Row + 1
        h4.Cells(u, "A") = cod
        h4.Cells(u, "B") = Date
        If ComboBox1 = "" Then
            CommandButton6_Click
        Else
            CommandButton1_Click
        End If
        MsgBox "Registro eliminado"
    End If
End Sub

S a l u d o s

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas