ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows (https://www.excelbanter.com/excel-programming/439283-delete-rows.html)

JohnUK

Delete Rows
 
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


Bob Phillips[_4_]

Delete Rows
 
Autofilter column B for blanks, then delete all visible rows.

HTH

Bob

"JohnUK" wrote in message
...
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




JohnUK

Delete Rows
 
Hi Bob, Thanks for help, but its 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?


"Bob Phillips" wrote:

Autofilter column B for blanks, then delete all visible rows.

HTH

Bob

"JohnUK" wrote in message
...
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



.


Gord Dibben

Delete Rows
 
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

On Sat, 6 Feb 2010 05:46:01 -0800, JohnUK
wrote:

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



JohnUK

Delete Rows
 
Fantastic, just what I wanted.
Many thanks
Gord
Regards
John

"Gord Dibben" wrote:

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

On Sat, 6 Feb 2010 05:46:01 -0800, JohnUK
wrote:

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


.


Bob Phillips[_4_]

Delete Rows
 
It can. Another way

With Activesheet

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

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

HTH

Bob

"JohnUK" wrote in message
...
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?


"Bob Phillips" wrote:

Autofilter column B for blanks, then delete all visible rows.

HTH

Bob

"JohnUK" wrote in message
...
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



.




Dana DeLouis[_3_]

Delete Rows
 
On 2/6/2010 8:46 AM, JohnUK wrote:
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


All times are GMT +1. The time now is 08:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com