Hi guys,

I have my data in the following format and I want to keep the rows in green, so delete all rows where the value in column 1 of the following row is not blank. [TABLE="border: 0, cellpadding: 0, cellspacing: 0"]

[TD="width: 155, align: right"]212345[/TD]

[TD="width: 259"]AB[/TD]

[TD="width: 15"]6[/TD]

[TD="width: 19"] [/TD]

[TD="width: 250"] [/TD]

[TD="align: right"]231354[/TD]

CD

[/td]5

[/td]A

[/td]ACEG

[/td]

[TD="align: right"]64685[/TD]

EF

[/td]6

[/td]

[TD="align: right"]465321[/TD]

GH

[/td]5

[/td]G

[/td]DHFL

[/td]

[TD="align: right"]546746853[/TD]

IJ

[/td]5

[/td]K

[/td]ACEG

[/td]

[TD="align: right"]465464[/TD]

KL

[/td]6

[/td]

[TD="align: right"]54645[/TD]

MN

[/td]6

[/td]

[TD="align: right"]446843541[/TD]

OP

[/td]5

[/td]A

[/td]ACEG

[/td]

[TD="align: right"]584683[/TD]

QR

[/td]6

[/td]

[TD="align: right"]54654354[/TD]

ST

[/td]5

[/td]F

[/td]DHFL

[/td]

[TD="align: right"]435454[/TD]

UV

[/td]5

[/td]A

[/td]DHFL

[/td]LMOP

[/td]D

[/td]ACEG

[/td]

[TD="align: right"]5485435[/TD]

WX

[/td]5

[/td]D

[/td]DHFL

[/td]

[TD="align: right"]46546[/TD]

YZ

[/td]5

[/td]K

[/td]ACEG

[/td]DHFL

[/td]

[TD="align: right"]346543[/TD]

AC

[/td]5

[/td]F

[/td]DHFL

[/td]

[/TABLE]

This is the code I have but it doesn't seem to be doing what I want, appreciate if someone could tell me what I am doing wrong:

```
Sub DeleteRowsNotFollowedByBlankCells()
Application.ScreenUpdating = False
Dim x
For x = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row To ActiveCell.Row Step -1
Debug.Print x
Debug.Print ActiveCell.Row
Debug.Print Cells(x + 1, 1)
If Cells(x + 1, 1) = vbNullString Then 'If we find this text
ElseIf Cells(x + 1, 1) <> vbNullString Then
Cells(x, 1).EntireRow.Delete
End If
Next x
Application.ScreenUpdating = True
End Sub
```

Display More
Thanks in advance!!

Amruta