PC Review


Reply
 
 
Shawn
Guest
Posts: n/a
 
      8th May 2009
I need the code below altered so it deletes the entire row the blank cell is
in.

Dim xRange As Range
Dim xCell As Range

For Each xCell In Sheets("CDPTR").Range("A2:A25")
If xCell.Value = 0 Then
If xRange Is Nothing Then
Set xRange = xCell
Else
Set xRange = Union(xRange, xCell)
End If
End If
Next xCell
xRange.Delete Shift:=xlup


--
Thanks
Shawn
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      8th May 2009
Replace the last line of the code with

xRange.EntireRow.Delete

If this post helps click Yes
---------------
Jacob Skaria


"Shawn" wrote:

> I need the code below altered so it deletes the entire row the blank cell is
> in.
>
> Dim xRange As Range
> Dim xCell As Range
>
> For Each xCell In Sheets("CDPTR").Range("A2:A25")
> If xCell.Value = 0 Then
> If xRange Is Nothing Then
> Set xRange = xCell
> Else
> Set xRange = Union(xRange, xCell)
> End If
> End If
> Next xCell
> xRange.Delete Shift:=xlup
>
>
> --
> Thanks
> Shawn

 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      8th May 2009
Hi

Use this:

xRange.EntireRow.Delete

Regards,
Per

On 8 Maj, 14:03, Shawn <Sh...@discussions.microsoft.com> wrote:
> I need the code below altered so it deletes the entire row the blank cell is
> in.
>
> * * * * * * * * * * Dim xRange As Range
> * * * * * * * * * * Dim xCell As Range
>
> * * * * * * * * * * For Each xCell In Sheets("CDPTR").Range("A2:A25")
> * * * * * * * * * * * * If xCell.Value = 0 Then
> * * * * * * * * * * * * * * If xRange Is Nothing Then
> * * * * * * * * * * * * * * * * Set xRange = xCell
> * * * * * * * * * * * * * * Else
> * * * * * * * * * * * * * * * * Set xRange = Union(xRange, xCell)
> * * * * * * * * * * * * * * End If
> * * * * * * * * * * * * End If
> * * * * * * * * * * Next xCell
> * * * * * * * * * * xRange.Delete Shift:=xlup
>
> --
> Thanks
> Shawn


 
Reply With Quote
 
Shawn
Guest
Posts: n/a
 
      8th May 2009
Great. That works. I was using this code and it wasn't working:

Range("xRange" & ActiveCell.Row).EntireRow.Delete Shift:=xlUp

--
Thanks
Shawn


"Jacob Skaria" wrote:

> Replace the last line of the code with
>
> xRange.EntireRow.Delete
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Shawn" wrote:
>
> > I need the code below altered so it deletes the entire row the blank cell is
> > in.
> >
> > Dim xRange As Range
> > Dim xCell As Range
> >
> > For Each xCell In Sheets("CDPTR").Range("A2:A25")
> > If xCell.Value = 0 Then
> > If xRange Is Nothing Then
> > Set xRange = xCell
> > Else
> > Set xRange = Union(xRange, xCell)
> > End If
> > End If
> > Next xCell
> > xRange.Delete Shift:=xlup
> >
> >
> > --
> > Thanks
> > Shawn

 
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
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? Microsoft Excel Programming 6 7th Oct 2009 12:28 PM
Excel Line Feed Character - How to delete the CHR(10) and keep the formatting without going to single line.. Microsoft Excel Discussion 7 7th Oct 2009 11:13 AM
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? Microsoft Excel Worksheet Functions 7 7th Oct 2009 11:10 AM
Delete line in sheet, deletes same line in add'l sheets =?Utf-8?B?U3VlMTI5NDU=?= Microsoft Excel Crashes 1 9th Jan 2007 07:25 AM
How do I delete single solid line, Auto, 1.5 pt line width? =?Utf-8?B?Q2Fyb2xlIGluIFZhY2F2aWxsZQ==?= Microsoft Word Document Management 1 8th Mar 2006 07:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:42 PM.