PC Review


Reply
Thread Tools Rate Thread

Delete rows if particular cell empty

 
 
Code Numpty
Guest
Posts: n/a
 
      29th Feb 2008
I need to include an instruction in a macro to delete rows, based on one cell
being empty.

If cell c10 (range name = "deliver_line1") is empty, then I want to delete
rows 10 to 15 (range name = "deliver_rows).

I have used
Range("Item_Nos").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
elsewhere, but this must relate to a cell which is not the first in the row.

Grateful for any help, thanks.
 
Reply With Quote
 
 
 
 
DomThePom
Guest
Posts: n/a
 
      29th Feb 2008
If IsEmpty(Range("deliver_line1")) Then
Sheets(1).Rows("10:15").EntireRow.Delete
End If

"Code Numpty" wrote:

> I need to include an instruction in a macro to delete rows, based on one cell
> being empty.
>
> If cell c10 (range name = "deliver_line1") is empty, then I want to delete
> rows 10 to 15 (range name = "deliver_rows).
>
> I have used
> Range("Item_Nos").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
> elsewhere, but this must relate to a cell which is not the first in the row.
>
> Grateful for any help, thanks.

 
Reply With Quote
 
Code Numpty
Guest
Posts: n/a
 
      29th Feb 2008
Thanks Dom, I had to tweak it a bit to.....

If IsEmpty(Range("deliver_line1")) _
Then Sheets(1).Range("deliver_rows").EntireRow.Delete

When I first tried your code, it produced a compile error. No End If is
required as there is only one action as a result of the If, (apparently).

"DomThePom" wrote:

> If IsEmpty(Range("deliver_line1")) Then
> Sheets(1).Rows("10:15").EntireRow.Delete
> End If
>


 
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
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Microsoft Excel Worksheet Functions 0 13th Dec 2006 01:25 AM
Delete Rows with Empty Cells with empty column 1 Scott Microsoft Excel Programming 6 2nd Oct 2006 11:57 PM
delete rows where that contain an empty cell gerry.lisa@gmail.com Microsoft Excel Discussion 5 22nd Aug 2006 02:52 AM
Delete empty rows with cell type 2 FrankNL Microsoft Excel Misc 1 3rd May 2006 11:10 AM
Delete rows foward if cell is empty Metrazal Microsoft Excel Programming 5 25th Feb 2006 01:26 AM


Features
 

Advertising
 

Newsgroups
 


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