Skip to content

Instantly share code, notes, and snippets.

@epjuan21
Last active August 15, 2019 20:43
Show Gist options
  • Save epjuan21/97ca5dcd3a1d55c763d0dfd30ca8739f to your computer and use it in GitHub Desktop.
Save epjuan21/97ca5dcd3a1d55c763d0dfd30ca8739f to your computer and use it in GitHub Desktop.
Eliminar Fila Según Criterio en VBA - Delete Row According to Criteria
Sub DeleteRow()
Application.ScreenUpdating = False
'Columna donse se ecuentra el criterio
'Column where the criterion is found
Col = 7
'We set the criteria
'Establecemos el Criterio
Criterio = "Criteria"
'Obtenemos el Numero de Filas
'We get the Number of Rows
NumeroFilas = Cells(Rows.Count, 2).End(xlUp).Row
Dim I As Integer
I = 0
For I = 10 To NumeroFilas
If Cells(I, Col).Value <> "" Then
If Cells(I, Col).Value = Criterio Then
Cells(I, Col).EntireRow.Delete
'Luego de borrar la fila debemos recalcular el numero de filas
'After deleting the row we must recalculate the number of rows
NumeroFilas = NumeroFilas - 1
I = I - 1
End If
End If
Next I
Application.ScreenUpdating = False
End Sub
@epjuan21
Copy link
Author

Código de Visual Basic for Applications para eliminar filas en una tabla, según un criterio establecido.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment