Excel VBA macro: delete rows based on cell value (zeros and spaces)

HomeOther ContentExcel VBA macro: delete rows based on cell value (zeros and spaces)
Excel VBA macro: delete rows based on cell value (zeros and spaces)
Excel VBA macro: delete rows based on cell value (zeros and spaces)
Excel VBA macro: delete rows based on cell value (zeros and spaces). We create a macro that deletes rows based on the value of the cell with specific text. If you ever need to delete all the rows containing a specific value in an Excel worksheet, you can use this code to delete these rows.

In this example, we remove lines containing zeros and specifically remove blank lines. The code searches for a specific value in a designated column, then deletes that entire row if it contains the value you want to delete. The macro counts the total number of rows in the data set, then iterates through each row looking for the specific value in order to remove the entire row, until it reaches the bottom of the range.

Subscribe: https://youtube.com/@greggowaffles

Need help opening the VBA editor?
https://youtu.be/j2WB4EhkL_s

Coded:
Under delete_zeros()

Dim counts as long
Decrease me as long

count ActiveSheet.Cells(Rows.count, /"A/").End(xlUp).Row
'number of message boxes

I 1

Do while I count

If Cells(i, 7) 0 Then

Rows(i).EntireRow.Delete
ii-1

End if

ii 1
count ActiveSheet.Cells(Rows.count, /"A/").End(xlUp).Row

Loop

End of the submarine

#ExcelVBA #ExcelMacro

Please take the opportunity to connect and share this video with your friends and family if you find it useful.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *