PC Review


Reply
Thread Tools Rate Thread

Comparing columns and deleting rows based on criteria

 
 
=?Utf-8?B?QUxBVEw=?=
Guest
Posts: n/a
 
      6th Nov 2006
I have the following columns that are a result of a pivot table. I would like
to delete the folllowing occurences. I tried using the range function but got
a runtime error 1004. Something like:

' If Not Range("Col1").Value Is Nothing Then
' Rows.Delete

Col1 Col2
a a b
X X X
X (delete)
X X
X X
X (delete)

I want to delete rows where Col1 = X and Col2 = X does not exist. To
complicate things, this is a pivot table where Col1 and Col2 are further
broken down into a and b. I thought that by using Range that a and b would
not need to be accounted for individually. Thanks for any help!

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      6th Nov 2006
You can delete source data records of a pivot table (assuming the data is
sourced from the worksheet) but you can not delete any part of the pivot
table...
--
HTH...

Jim Thomlinson


"ALATL" wrote:

> I have the following columns that are a result of a pivot table. I would like
> to delete the folllowing occurences. I tried using the range function but got
> a runtime error 1004. Something like:
>
> ' If Not Range("Col1").Value Is Nothing Then
> ' Rows.Delete
>
> Col1 Col2
> a a b
> X X X
> X (delete)
> X X
> X X
> X (delete)
>
> I want to delete rows where Col1 = X and Col2 = X does not exist. To
> complicate things, this is a pivot table where Col1 and Col2 are further
> broken down into a and b. I thought that by using Range that a and b would
> not need to be accounted for individually. Thanks for any help!
>

 
Reply With Quote
 
=?Utf-8?B?QUxBVEw=?=
Guest
Posts: n/a
 
      6th Nov 2006
Yes, I am aware of this. I did a copy and paste of the data to a new
worksheet. I am trying to delete the rows from the new worksheet.

Thanks!

"Jim Thomlinson" wrote:

> You can delete source data records of a pivot table (assuming the data is
> sourced from the worksheet) but you can not delete any part of the pivot
> table...
> --
> HTH...
>
> Jim Thomlinson
>
>
> "ALATL" wrote:
>
> > I have the following columns that are a result of a pivot table. I would like
> > to delete the folllowing occurences. I tried using the range function but got
> > a runtime error 1004. Something like:
> >
> > ' If Not Range("Col1").Value Is Nothing Then
> > ' Rows.Delete
> >
> > Col1 Col2
> > a a b
> > X X X
> > X (delete)
> > X X
> > X X
> > X (delete)
> >
> > I want to delete rows where Col1 = X and Col2 = X does not exist. To
> > complicate things, this is a pivot table where Col1 and Col2 are further
> > broken down into a and b. I thought that by using Range that a and b would
> > not need to be accounted for individually. Thanks for any help!
> >

 
Reply With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      6th Nov 2006
This should be closer to what you want...

Dim rngToDelete As Range

On Error Resume Next
Set rngToDelete = Columns("A").SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not rngToDelete Is Nothing Then _
rngToDelete.EntireRow.Delete

--
HTH...

Jim Thomlinson


"ALATL" wrote:

> Yes, I am aware of this. I did a copy and paste of the data to a new
> worksheet. I am trying to delete the rows from the new worksheet.
>
> Thanks!
>
> "Jim Thomlinson" wrote:
>
> > You can delete source data records of a pivot table (assuming the data is
> > sourced from the worksheet) but you can not delete any part of the pivot
> > table...
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> >
> > "ALATL" wrote:
> >
> > > I have the following columns that are a result of a pivot table. I would like
> > > to delete the folllowing occurences. I tried using the range function but got
> > > a runtime error 1004. Something like:
> > >
> > > ' If Not Range("Col1").Value Is Nothing Then
> > > ' Rows.Delete
> > >
> > > Col1 Col2
> > > a a b
> > > X X X
> > > X (delete)
> > > X X
> > > X X
> > > X (delete)
> > >
> > > I want to delete rows where Col1 = X and Col2 = X does not exist. To
> > > complicate things, this is a pivot table where Col1 and Col2 are further
> > > broken down into a and b. I thought that by using Range that a and b would
> > > not need to be accounted for individually. Thanks for any help!
> > >

 
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
deleting rows based on criteria gbpg Microsoft Excel Programming 7 16th Aug 2008 05:23 AM
Deleting Rows Based on Criteria bgoode Microsoft Access Macros 1 24th Apr 2008 04:33 PM
Sum based on criteria in rows and columns =?Utf-8?B?RXN0aGVySg==?= Microsoft Excel Misc 1 1st Nov 2005 10:28 AM
Deleting entire rows based on certain criteria Nan Microsoft Excel Programming 1 12th Jul 2004 05:04 PM
Deleting rows based on criteria John Walker Microsoft Excel Programming 2 12th Dec 2003 08:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:09 AM.