Last active
August 15, 2019 20:43
-
-
Save epjuan21/97ca5dcd3a1d55c763d0dfd30ca8739f to your computer and use it in GitHub Desktop.
Eliminar Fila Según Criterio en VBA - Delete Row According to Criteria
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Código de Visual Basic for Applications para eliminar filas en una tabla, según un criterio establecido.