![Excel VBA macro: delete rows based on cell value (zeros and spaces)](https://ytimg.googleusercontent.com/vi/Waa7Ew2n6T0/hqdefault.jpg)
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