Created
April 13, 2016 19:23
-
-
Save erajanraja24/0df819b59301ea67965ee5854dbe86ed to your computer and use it in GitHub Desktop.
Excel VBA macro to delete rows based on condition
This file contains hidden or 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 deleterowsvba() | |
Dim lrow As Integer, i As Integer | |
'Determine the last row of column A in sheet 1 | |
lrow = ThisWorkbook.Sheets(1).Range("A65356").End(xlUp).Row | |
'Find and delete the rows which contain property 2 starting from the last column | |
For i = lrow To 2 Step -1 | |
If ThisWorkbook.Sheets(1).Cells(i, 2) = 2 Then | |
ThisWorkbook.Sheets(1).Rows(i).EntireRow.Delete | |
End If | |
Next i | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment