MSGBOX en botón eliminar de Excel
Tengo el siguiente código y quisiera que antes de eliminar el registro me pregunte si estoy segura de eliminarlo y al hacerlo me informe que fue eliminado ese registro. El registro se encuentra por el RNOS (columna 2).
Espero puedan ayudarme.
Muchas gracias
Private Sub BT_eliminar_Click()
Dim FILA As Long, i As Long, I2 As Long
FILA = Hoja10.Range("A" & Rows.Count).End(xlUp).Row + 1 'encuentra la primera fila vacia
For i = 2 To FILA - 1
If Val(listbox.List(listbox.ListIndex - 0, 0)) = Val(Hoja10.Cells(i, 1)) Then
Hoja10.Rows(i).Delete
Exit For
End If
Next i
listbox.Clear
For I2 = 2 To FILA - 1
With listbox
. AddItem
. List(.ListCount - 1, 0) = Hoja10. Cells(I2, 1) 'CODIGO
. List(.ListCount - 1, 1) = Hoja10. Cells(I2, 2) 'RNOS
. List(.ListCount - 1, 2) = Hoja10. Cells(I2, 3) 'EXPEDIENTE
. List(.ListCount - 1, 3) = Hoja10. Cells(I2, 4) 'FECHA INGRESO
. List(.ListCount - 1, 4) = Hoja10. Cells(I2, 5) 'EJERCICIO
. List(.ListCount - 1, 6) = Hoja10. Cells(I2, 7) 'ESTADO
. List(.ListCount - 1, 7) = Hoja10. Cells(I2, 8) 'PERIODO
. List(.ListCount - 1, 8) = Hoja10. Cells(I2, 9) 'ANALISTA
End With
Next I2
'vaciar los campos
rnos = Empty
expediente = Empty
fechaingreso = Empty
ejercicio = Empty
estado = Empty
periodo = Empty
analista = Empty
año = Empty
sigla = Empty
nombreos = Empty
cuit = Empty
email = Empty
inicioperiodo = Empty
finperiodo = Empty
dispo = Empty
fechadispo = Empty
atiempo = Empty
End Sub
1 respuesta
Respuesta de Dante Amor
2