GirishDhruva
Active Member
- Joined
- Mar 26, 2019
- Messages
- 308
Hi Everyone,
Here i am trying to delete entire row if the value in column 'I' is 0.
The below code works but it also deletes the empty spaces that are present in column'I' where that shouldn't happen
Can anyone suggest/guide me what changes i should make ??????
like
it should delete only the the value with 0(entire row), not the cell that contains empty spaces
[TABLE="width: 500"]
<tbody>[TR]
[TD]column D[/TD]
[TD]Column I[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1234[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]54213[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]3456[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance
Here i am trying to delete entire row if the value in column 'I' is 0.
The below code works but it also deletes the empty spaces that are present in column'I' where that shouldn't happen
Can anyone suggest/guide me what changes i should make ??????
Code:
last = Cells(Rows.Count, "D").End(xlUp).Row
For i = last To 4 Step -1
If Cells(i, "I").Value = 0 Then
Cells(i, "I").EntireRow.Delete
End If
Next i
like
it should delete only the the value with 0(entire row), not the cell that contains empty spaces
[TABLE="width: 500"]
<tbody>[TR]
[TD]column D[/TD]
[TD]Column I[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1234[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]54213[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]3456[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance
Last edited: