Delete Rows

  • Thread starter Thread starter JohnUK
  • Start date Start date
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
 
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?
 
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
 
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
 
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
 
Back
Top