#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default 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



.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete & Merge Columns,Delete Rows with filter, etc traderindia Excel Programming 1 July 16th 09 08:17 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir manfareed Excel Programming 4 September 28th 07 05:20 PM
Copy pasting Rows, but need to Delete any Shapes/Pictures that are within copied rows Corey Excel Programming 2 August 1st 07 02:02 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 11:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"