Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
delete group of check box all at once | Excel Discussion (Misc queries) | |||
Macro to delete a group of CELLS | Excel Discussion (Misc queries) | |||
Delete a group of alternate cells | New Users to Excel | |||
delete group box | Excel Discussion (Misc queries) | |||
Group and Delete | Excel Programming |