PC Review


Reply
Thread Tools Rate Thread

Delete rows if column looks blank

 
 
robyn_willson@hotmail.com
Guest
Posts: n/a
 
      18th Feb 2009
I need a macro to delete the entire row if the cell in that row in column A:A
looks blank. I need it to check every row. I say "looks" because the cells
will be part of a list, however I would still like them to be deleted if they
have a formula if they look as though nothing is in them... Please help...
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      18th Feb 2009
Sub killum()
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, 1).Value = "" Then
Cells(i, 1).EntireRow.Delete
End If
Next
End Sub

--
Gary''s Student - gsnu200834


"(E-Mail Removed)" wrote:

> I need a macro to delete the entire row if the cell in that row in column A:A
> looks blank. I need it to check every row. I say "looks" because the cells
> will be part of a list, however I would still like them to be deleted if they
> have a formula if they look as though nothing is in them... Please help...

 
Reply With Quote
 
robyn_willson@hotmail.com
Guest
Posts: n/a
 
      18th Feb 2009
This makes it check them inifinitely so the macro never stops. Why does this
happen? Is there a way to fit it?

"Gary''s Student" wrote:

> Sub killum()
> n = Cells(Rows.Count, 1).End(xlUp).Row
> For i = n To 1 Step -1
> If Cells(i, 1).Value = "" Then
> Cells(i, 1).EntireRow.Delete
> End If
> Next
> End Sub
>
> --
> Gary''s Student - gsnu200834
>
>
> "(E-Mail Removed)" wrote:
>
> > I need a macro to delete the entire row if the cell in that row in column A:A
> > looks blank. I need it to check every row. I say "looks" because the cells
> > will be part of a list, however I would still like them to be deleted if they
> > have a formula if they look as though nothing is in them... Please help...

 
Reply With Quote
 
egun
Guest
Posts: n/a
 
      18th Feb 2009
Probably by modifying to look something like this:

Sub killum()
n = Cells(Rows.Count, 1).End(xlUp).Row
While (n >= 1)
If Cells(n, 1).Value = "" Then
Cells(n, 1).EntireRow.Delete
n = n - 1
End If
Wend
End Sub

HTH,

Eric

"(E-Mail Removed)" wrote:

> This makes it check them inifinitely so the macro never stops. Why does this
> happen? Is there a way to fit it?
>
> "Gary''s Student" wrote:
>
> > Sub killum()
> > n = Cells(Rows.Count, 1).End(xlUp).Row
> > For i = n To 1 Step -1
> > If Cells(i, 1).Value = "" Then
> > Cells(i, 1).EntireRow.Delete
> > End If
> > Next
> > End Sub
> >
> > --
> > Gary''s Student - gsnu200834
> >
> >
> > "(E-Mail Removed)" wrote:
> >
> > > I need a macro to delete the entire row if the cell in that row in column A:A
> > > looks blank. I need it to check every row. I say "looks" because the cells
> > > will be part of a list, however I would still like them to be deleted if they
> > > have a formula if they look as though nothing is in them... Please help...

 
Reply With Quote
 
egun
Guest
Posts: n/a
 
      18th Feb 2009
Actually, Gary's code should work just fine (upon actually looking at it!).
It should not create an infinite loop situation. Please check to ensure you
got the "Step -1" part in your code - if you have "Step 1" or nothing at all,
the loop will go on forever.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete all rows where column A is blank Jodie Microsoft Excel Programming 6 14th Dec 2009 07:30 PM
delete the non blank rows depending on Column Harn88 Microsoft Excel Programming 1 18th Nov 2008 08:37 AM
Delete Blank Rows - specify column via dialog porter444 Microsoft Excel Programming 1 30th Nov 2007 04:45 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir =?Utf-8?B?bWFuZmFyZWVk?= Microsoft Excel Programming 4 28th Sep 2007 05:20 PM
Delete entire rows where there is a blank in column A Chris Hankin Microsoft Excel Programming 7 11th Jun 2006 09:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:12 PM.