Delete Rows

J

JohnUK

Hi, I am after a piece of code that will delete all empty rows downwards from
1st row until it hits data in column B. I can see plenty of threads
explaining how to delete upwards until it hits data, but not downwards.
Help greatly appreciated
 
J

JohnUK

Hi Bob, Thanks for help, but it’s not as simple as that. There is a lot of
manipulation of data that gets copied from one tab to another, gets sorted,
has rows inserted between certain data,
then back.
Can the rows not be deleted through code then?
 
G

Gord Dibben

Blanks in column B down to say B7?

Sub delete_blank_rows()
Range(Cells(1, 2), Cells(1, 2).End(xlDown).Offset(-1)) _
.EntireRow.Delete
End Sub


Gord Dibben MS Excel MVP
 
B

Bob Phillips

It can. Another way

With Activesheet

LastRow = .Cells(>Rows.Count, "B").End(xlUp).Row

.Range("B1").Resize(LastRow).SpecialCells(xlCellTypeBlanks).Entirerow.Delete
End With

HTH

Bob
 
D

Dana DeLouis

Hi, I am after a piece of code that will delete all empty rows downwards from
1st row until it hits data in column B. I can see plenty of threads
explaining how to delete upwards until it hits data, but not downwards.
Help greatly appreciated

Just another slight variation:

Sub Demo()
With [B:B] 'Column
If .Cells(1) = vbNullString Then
.SpecialCells(xlCellTypeBlanks).Areas(1).EntireRow.Delete
End If
End With
End Sub

= = = = = = =
HTH :>)
Dana DeLouis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top