Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Do not delete last item of each

I have a worksheet with a large list of line items that has many duplicates.
I want to be able to delete some of these line items, but not all of them. I
want code that will protect the last of each duplicate line item, by not
allowing me to delete all of the line items. If you need more detail, let me
know.

Kent
--
Thanks for the help (I need all I can get!)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Do not delete last item of each

Do you have to have VBA, or will worksheet formulas suffice? If this is a
one-time job, formulas should be OK.

Does your list consist of a single column? Do you determine which rows are
duplicates by looking at just one column or all columns? I suspect the former,
because if the latter were true it wouldn't make any difference which one you
keep.

If the latter, look at Filter/Advanced and select Unique Records Only.

If the former, let's assume that you are interested only in duplication of the
information in column A, the list occupies A1:G500, you have headers in row 1,
and the first data row is 2.

In H2, put this formula

=COUNTIF($A2:$A$500,$A2)

and copy it down.

Then use AutoFilter to display those rows where there's a 1 in column H. Those
are the last entry for the item in column A. You can now copy these rows to
another location.

Or, if you want to go ahead and delete the items, change the filter to display
rows where the value is 1. Then delete the visible rows.


On Mon, 18 Oct 2004 17:01:09 -0700, "KentKHI"
wrote:

I have a worksheet with a large list of line items that has many duplicates.
I want to be able to delete some of these line items, but not all of them. I
want code that will protect the last of each duplicate line item, by not
allowing me to delete all of the line items.


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
how to delete 1 item in colum jarcher06 Excel Discussion (Misc queries) 2 March 18th 07 09:11 PM
How to delete item on right click menu? Bobo Excel Discussion (Misc queries) 1 August 28th 05 04:53 PM
How do I delete the same item from all pages of a workbook? Suz Excel Worksheet Functions 2 August 23rd 05 03:06 PM
Delete an Item in a list box Fred Jacobowitz Excel Programming 2 September 1st 04 01:34 PM
Find item and delete rows Joseph[_28_] Excel Programming 1 April 20th 04 06:55 PM


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

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"