LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Newbie question on deleting duplicate rows

I'm an Excel VBA newbie trying to delete rows from a spreadsheet based
upon duplicated values in a particular column (the sheet has been
sorted by the column of interest). I want the macro to compare the
value of the activecell with the value of the cell in next row (same
column). If the values are identical I want the entire row beneath
the current row to be deleted.

I suspect the code below is slow (if I could get it to run), but I'd
love to see what I'm doing wrong. Any help would be appreciated.
Thanks


LastRow = Selection.SpecialCells(xlLastCell).Row

For x = 1 To LastRow
If ActiveCell.Value = ActiveCell.Offset(1, 0).Value Then
ActiveCell.Offset(1, 0).EntireRow.Delete
End If
ActiveCell.Offset(1, 0).Select
Next x

Thanks
Phil Horwood
 
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 duplicate rows Ranju Excel Discussion (Misc queries) 1 January 28th 09 12:14 PM
Find duplicate rows then deleting them SSHO_99 Excel Worksheet Functions 4 May 4th 07 11:17 AM
deleting duplicate rows Jess Excel Discussion (Misc queries) 3 January 9th 07 11:16 PM
Deleting duplicate rows Kevin Excel Discussion (Misc queries) 1 May 2nd 06 12:16 AM
Deleting Duplicate Rows pettes01 Excel Discussion (Misc queries) 4 November 8th 05 06:50 PM


All times are GMT +1. The time now is 11:02 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"