Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default DELETING BLANK ROWS

Hello,

I there an easy way to delete all rows if a certain colum is blank?
I have 5000 rows and wish to delete all, f colum b is blank.

Thank you



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default DELETING BLANK ROWS

Hi
try the following macro:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, 2).Value = "" then
rows(row_index).delete
End If
Next
Application.ScreenUpdating = True
End Sub

also have a look at:
http://www.xldynamic.com/source/xld.Deleting.html

--
Regards
Frank Kabel
Frankfurt, Germany


Robert Lowe wrote:
Hello,

I there an easy way to delete all rows if a certain colum is blank?
I have 5000 rows and wish to delete all, f colum b is blank.

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default DELETING BLANK ROWS

Try this Robert

Sub DeleteBlankRows()
On Error Resume Next 'In case there are no blank rows
Columns("B").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
On Error GoTo 0
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Robert Lowe" wrote in message .. .
Hello,

I there an easy way to delete all rows if a certain colum is blank?
I have 5000 rows and wish to delete all, f colum b is blank.

Thank you





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default DELETING BLANK ROWS

Thank you both, they work great!

Regards
Robert

"Robert Lowe" wrote in message
.. .
Hello,

I there an easy way to delete all rows if a certain colum is blank?
I have 5000 rows and wish to delete all, f colum b is blank.

Thank you





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
deleting blank rows KRK New Users to Excel 3 June 27th 09 12:51 PM
Deleting blank rows Yvette Excel Worksheet Functions 3 June 9th 06 10:30 AM
Deleting Blank Rows Reeni New Users to Excel 4 December 15th 05 01:56 AM
deleting blank rows Ryan H. Excel Programming 2 August 3rd 04 03:27 AM
Deleting Blank Rows LC[_5_] Excel Programming 1 June 3rd 04 06:55 PM


All times are GMT +1. The time now is 07:11 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"