Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Group and Delete

Kirk,

One way might be this (untested):

Assuming that CustID is in column A

''''''''''''''''''''''''''
Sub DeleteExcessID()
Dim x As Long
Application.ScreenUpdating = False
' screen updating off speeds up code execution
For x = 500 To 1 Step -1
' set x = whatever you need
If Len(Cells(x, 1)) 0 And Cells(x, 1) = Cells(x + 1, 1) Then
' tests for something in cell and if cell = to cell below
Rows(x).Delete
End If
Next
Application.ScreenUpdating = True
End Sub
''''''''''''''''''''''''''''
hth
--
steveb
(Remove 'NOSPAM' from email address if replying direct)


"Kirk P." wrote in message
...
I'm looking for a procedure that would select the last row within a group

and delete all rows BUT the last row. For example:

CustID CustName Sales
1000 Acme Corp 100
1000 Acme Corp 150
1000 Acme Corp 200
1001 Navy Corp 50
1001 Navy Corp 25
1001 Navy Corp 10

I want to select the LAST row within each CustID group, and delete all

other rows BUT the last row. Any ideas?



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
delete group of check box all at once Marta Excel Discussion (Misc queries) 2 August 24th 06 10:40 AM
Macro to delete a group of CELLS Excel Discussion (Misc queries) 4 May 8th 06 04:29 PM
Delete a group of alternate cells poleary53 New Users to Excel 1 March 7th 06 11:05 PM
delete group box Mass group box delete Excel Discussion (Misc queries) 4 October 16th 05 02:43 AM
Group and Delete kkknie[_93_] Excel Programming 0 May 13th 04 04:33 PM


All times are GMT +1. The time now is 03:07 AM.

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

About Us

"It's about Microsoft Excel"