Hi all,
I'd like to delete rows that are blank, my code below
I have to run the code 4-5 times to get result. Can anyone help to explain for me ?
Sub test()
Dim lastrow2, x As Integer
lastrow2 = Sheets("GPE").Range("A2").CurrentRegion.Rows.Count
For x = 2 To lastrow2
If Sheets("GPE").Cells(x, 4) = "" Then
Sheets("GPE").Rows(x).EntireRow.Delete
End if
Next x
End Sub
I'd like to delete rows that are blank, my code below
I have to run the code 4-5 times to get result. Can anyone help to explain for me ?
Sub test()
Dim lastrow2, x As Integer
lastrow2 = Sheets("GPE").Range("A2").CurrentRegion.Rows.Count
For x = 2 To lastrow2
If Sheets("GPE").Cells(x, 4) = "" Then
Sheets("GPE").Rows(x).EntireRow.Delete
End if
Next x
End Sub