Hi everyone,
I have been trying to write a macro on deleting the rows with column B cells empty, that is deleting B3 and B4 in the data below. I used an If and Else statements and loop them until B7.
<tbody>
</tbody>
My code is as follows:
However, while running the macro, my excel freezes with the word [running] on top of the VBA editor. Is there any problem with my code?
Thanks!
I have been trying to write a macro on deleting the rows with column B cells empty, that is deleting B3 and B4 in the data below. I used an If and Else statements and loop them until B7.
A | 1 |
B | 2 |
C | |
D | |
E | 3 |
F | 4 |
<tbody>
</tbody>
My code is as follows:
Code:
Sub proDelete()
Range("b1").Select
Do Until ActiveCell.Row = 7
If Selection.Value = "" Then
Selection.EntireRow.Delete
Else
Selection.Offset(1, 0).Select
End If
Loop
Range("A1").Select
End Sub
However, while running the macro, my excel freezes with the word [running] on top of the VBA editor. Is there any problem with my code?
Thanks!