Delete blank rows sub

Seamus2626
Seamus2626 used Ask the Experts™
on
Hi,

Im looking for some code that will delete blank rows in a ws

I need it to go to the end and then go up to the last row (use ColA) and then use that as count. The reason is, there may only be 150 entries, so i dont want it deleting all rows

Thanks
Seamus
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015
Commented:

Use this code...

Saurabh...
Sub deleterows()
    Dim lr As Long
    Dim lrow As Long
lr = Cells(Cells.Rows.Count, "A").End(xlUp).Row

    lrow = 1

    Do Until lrow > lr

        If Application.WorksheetFunction.CountA(Range(lrow & ":" & lrow)) = 0 Then
            Rows(lrow).Delete
            lr = Cells(Cells.Rows.Count, "A").End(xlUp).Row
        Else
            lrow = lrow + 1
        End If
    Loop


End Sub

Open in new window

here you go
Sub x()

Lastrow = Cells(65536, 1).End(xlUp).Row

While i < Lastrow

    If Cells(i, 1).Value = "" Then
        Row(i).Delete
    Else
        i = i + 1
    End If
Wend

    
End Sub

Open in new window

Author

Commented:
Thanks guys

Cheers,
Seamus

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial