Bienvenido a la mayor comunidad de usuarios EXCEL

Regístrate gratis ahora para ver contenidos y descargas sin restricciones!

Regístrate gratis

Error "1004"

jcvelez

Active member
Registrado
1 Mar 2013
Mensajes
914
Hola trabajando en la hoja "Cliente" surge el Error "1004" cuando por 2° ves quiero eliminar un elemento de dicha tabla
Con el siguiente comentario "Se ha producido el error "1004" en tiempo de...
Para poder visualizar el resto de este tema y sus adjuntos:
. Si nunca te has registrado puedes registrarte gratis aquí
. Si ya te has registrado debes
iniciar sesión aquí
 

Adjuntos

Solución
El código es para el UserForm1

Código:
Private Sub BT_ELIMINARCLIENTE_Click()
  Dim tblCtes As ListObject
  Dim f As Range
  Dim respuesta As VbMsgBoxResult
  Dim idCliente As String
  
  idCliente = Txt_IDCLIENTE.Value
  Set tblCtes = Sheets("Clientes").ListObjects("tblClientes")
  If listaclientes.ListIndex = -1 Then
    MsgBox "Seleccione una fila", vbInformation, "los panes de Lola"
  Else
    respuesta = MsgBox("Realmente quiere ELIMINAR el cliente: " & idCliente, vbYesNo + vbQuestion, "Los panes de Lola")
    If respuesta = vbYes Then
      Set f = tblCtes.ListColumns("ID").Range.Find(idCliente, , xlValues, xlWhole)
      If Not f Is Nothing Then
        tblCtes.ListRows(f.Row - tblCtes.HeaderRowRange.Row).Delete
      End If...

Adjuntos

El código es para el UserForm1

Código:
Private Sub BT_ELIMINARCLIENTE_Click()
  Dim tblCtes As ListObject
  Dim f As Range
  Dim respuesta As VbMsgBoxResult
  Dim idCliente As String...
Para poder visualizar el resto de este tema y sus adjuntos:
. Si nunca te has registrado puedes registrarte gratis aquí
. Si ya te has registrado debes
iniciar sesión aquí
 

Adjuntos

Volver
Arriba