Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default delete entire row with condition

If the file is sorted on column A so that all duplicates are grouped, then:

Sub dups()
Dim lr As Long, sh as Worksheet
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 2 Step -1
If sh.Cells(i, 1) = sh.Cells(i - 1, 1) Then
Rows(i).Delete
End If
Next
End Sub

The file m8ust be sorted first for the macro to work.


"Anna" wrote in message
...
I would like to have a macro that scan a column (i.e. column a). Under the
scanned column, the entired row of any duplicate cell will be deleted.
(i.e.
cell a5=abc, cell a6, a7=abc, row a6 and a7 will be deleted). Anyone can
give
me a big hand?
Thank you so much.



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
To give back ground colour for entire row on certain condition pol Excel Discussion (Misc queries) 6 May 22nd 09 11:41 AM
Applying Max Conditonal Formatting to an entire row when condition SunshineinFt.Myers[_2_] Excel Worksheet Functions 2 February 24th 09 05:56 AM
How Do I Condition A Entire Row, Based On The Content Of A Single Frustrated-Emmily New Users to Excel 6 November 6th 08 04:57 PM
Conditional Format to highlight entire row if a condition is met klmiura Excel Worksheet Functions 5 November 22nd 07 02:30 PM
Can I delete an entire row if condition is not met? Christine Excel Worksheet Functions 8 May 4th 06 09:47 AM


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