Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
claytorm
 
Posts: n/a
Default Delete row if cell in col b is blank


Hi

I have a large sheet and need a macro to delete any row which does not
have a value in column B. So, if B32 was blank, the whole of row 32
would be deleted. Can anyone come up with a simple macro to do this?

Thanks,

Bertie


--
claytorm
------------------------------------------------------------------------
claytorm's Profile: http://www.excelforum.com/member.php...o&userid=11610
View this thread: http://www.excelforum.com/showthread...hreadid=483223

  #3   Report Post  
Gary''s Student
 
Posts: n/a
Default Delete row if cell in col b is blank

Try:

Sub rowremover()
Dim i As Long
For i = 65536 To 1 Step -1
If IsEmpty(Cells(i, 2)) Then
Rows(i).Select
Selection.Delete Shift:=xlUp
End If
Next
End Sub

Without VBA, just sort on column B and discard the blanks.
--


Gary's Student


"claytorm" wrote:


Hi

I have a large sheet and need a macro to delete any row which does not
have a value in column B. So, if B32 was blank, the whole of row 32
would be deleted. Can anyone come up with a simple macro to do this?

Thanks,

Bertie


--
claytorm
------------------------------------------------------------------------
claytorm's Profile: http://www.excelforum.com/member.php...o&userid=11610
View this thread: http://www.excelforum.com/showthread...hreadid=483223


  #5   Report Post  
Ron de Bruin
 
Posts: n/a
Default Delete row if cell in col b is blank

Hi claytorm

If they are really blank and no more then 8192 separate areas ?

With ActiveSheet
On Error Resume Next
.Columns("B").SpecialCells(xlCellTypeBlanks).Entir eRow.Delete
On Error GoTo 0
End With

Or other ways
http://www.rondebruin.nl/delete.htm


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


"claytorm" wrote in message
...

Hi

I have a large sheet and need a macro to delete any row which does not
have a value in column B. So, if B32 was blank, the whole of row 32
would be deleted. Can anyone come up with a simple macro to do this?

Thanks,

Bertie


--
claytorm
------------------------------------------------------------------------
claytorm's Profile: http://www.excelforum.com/member.php...o&userid=11610
View this thread: http://www.excelforum.com/showthread...hreadid=483223



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
leave a cell blank nicolas Excel Worksheet Functions 1 August 2nd 05 01:55 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
How to delete blank rows John Mansfield Excel Discussion (Misc queries) 3 April 27th 05 11:48 PM
blank cell turns to 0 LMB New Users to Excel 2 April 25th 05 03:57 PM
VLookup resulting in a blank cell... KempensBoerke Excel Worksheet Functions 1 October 28th 04 09:57 PM


All times are GMT +1. The time now is 06:37 PM.

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"