Bienvenido a la mayor comunidad de usuarios EXCEL

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

Regístrate gratis

Eliminar línea por celda con condición

Tango Rojo

Member
Registrado
16 Feb 2021
Mensajes
45
Eliminar línea por celda con condición
Todas/os!!

He creado esta macro para un proyecto pero me tira " SE ha producido el error 1004 en tiempos de ejecución: Error en el método Delete de la clase...
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í
 
Solución
Código:
Sub Botón1_Haga_clic_en()
Application.ScreenUpdating = False
Sheets("PLANILLA").Select
ActiveSheet.Unprotect Password:="ALFA"
Buscardato = InputBox("Especificar el dato COD")
Range("Tabla6[COD]").Select
Set Dato = Cells.Find(Buscardato, , , xlWhole)
If Not Dato Is Nothing Then
   Dato.EntireRow.Delete
Else
   MsgBox "No se ha encontrado el dato COD"
End If
Range("Tabla6[COD]").Select
ActiveSheet.Protect Password:="ALFA"
Application.ScreenUpdating = True
End Sub


Si no funciona, sube tu archivo.
Código:
Sub Botón1_Haga_clic_en()
Application.ScreenUpdating = False
Sheets("PLANILLA").Select
ActiveSheet.Unprotect Password:="ALFA"
Buscardato = InputBox("Especificar el dato COD")...
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

A mi me ha funcionado:
Código:
Sub Eliminar_linea_a()
Dim COD As Long, Data As Range
Application.ScreenUpdating = False
Sheets("PLANILLA").Select
ActiveSheet.Unprotect Password:="ALFA"
COD =...
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í
 
Última edición:
Volver
Arriba