Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Comparing columns and deleting rows based on criteria

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!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Comparing columns and deleting rows based on criteria

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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Comparing columns and deleting rows based on criteria

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!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Comparing columns and deleting rows based on criteria

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
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
Deleting blanks rows based on multiple criteria Pedros[_14_] Excel Programming 1 July 27th 06 05:44 AM
Deleting entire rows based on certain criteria Nan[_4_] Excel Programming 1 July 12th 04 05:04 PM
Deleting rows based on multiple criteria Sandip Shah Excel Programming 3 July 12th 04 01:57 PM
Deleting rows based on cell criteria jgranda Excel Programming 1 April 27th 04 06:41 PM
Deleting rows based on criteria John Walker[_2_] Excel Programming 2 December 12th 03 08:37 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"