PC Review


Reply
Thread Tools Rate Thread

Add one more criteria

 
 
=?Utf-8?B?U3RldmVk?=
Guest
Posts: n/a
 
      6th Jul 2007
Hello from Steved

The below Formula finds Duplicates and deletes.

Question please How do I also ask the formula to check Column E

Thefore the find Criteria would be Columns "A", "D", "E" then the duplicates
found Delete.

Sub DeleteTheOldies()
Dim RowNdx As Long
For RowNdx = Range("A1").End(xlDown).Row To 2 Step -1
If Cells(RowNdx, "A").Value = Cells(RowNdx - 1, "A").Value Then
If Cells(RowNdx, "D").Value <= Cells(RowNdx - 1, "D").Value Then
Rows(RowNdx).Delete
Else
Rows(RowNdx - 1).Delete
End If
End If
Next RowNdx
End Sub

Thankyou
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      6th Jul 2007
Hi SteveD

Sub DeleteTheOldies()
Dim RowNdx As Long
For RowNdx = Range("A1").End(xlDown).Row To 2 Step -1
If Cells(RowNdx, "A").Value = Cells(RowNdx - 1, "A").Value Then
If Cells(RowNdx, "D").Value <= Cells(RowNdx - 1, "D").Value Then
If Cells(RowNdx, "E").Value <= Cells(RowNdx - 1, "E").Value Then
Rows(RowNdx).Delete
Else
Rows(RowNdx - 1).Delete
End If
End If
End If
Next RowNdx
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Steved" <(E-Mail Removed)> wrote in message
news:5DE05535-A1DB-482A-95CD-(E-Mail Removed)...
> Hello from Steved
>
> The below Formula finds Duplicates and deletes.
>
> Question please How do I also ask the formula to check Column E
>
> Thefore the find Criteria would be Columns "A", "D", "E" then the
> duplicates
> found Delete.
>
> Sub DeleteTheOldies()
> Dim RowNdx As Long
> For RowNdx = Range("A1").End(xlDown).Row To 2 Step -1
> If Cells(RowNdx, "A").Value = Cells(RowNdx - 1, "A").Value Then
> If Cells(RowNdx, "D").Value <= Cells(RowNdx - 1, "D").Value Then
> Rows(RowNdx).Delete
> Else
> Rows(RowNdx - 1).Delete
> End If
> End If
> Next RowNdx
> End Sub
>
> Thankyou



 
Reply With Quote
 
=?Utf-8?B?U3RldmVk?=
Guest
Posts: n/a
 
      6th Jul 2007
Thankyou Bob

"Bob Phillips" wrote:

> Hi SteveD
>
> Sub DeleteTheOldies()
> Dim RowNdx As Long
> For RowNdx = Range("A1").End(xlDown).Row To 2 Step -1
> If Cells(RowNdx, "A").Value = Cells(RowNdx - 1, "A").Value Then
> If Cells(RowNdx, "D").Value <= Cells(RowNdx - 1, "D").Value Then
> If Cells(RowNdx, "E").Value <= Cells(RowNdx - 1, "E").Value Then
> Rows(RowNdx).Delete
> Else
> Rows(RowNdx - 1).Delete
> End If
> End If
> End If
> Next RowNdx
> End Sub
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> "Steved" <(E-Mail Removed)> wrote in message
> news:5DE05535-A1DB-482A-95CD-(E-Mail Removed)...
> > Hello from Steved
> >
> > The below Formula finds Duplicates and deletes.
> >
> > Question please How do I also ask the formula to check Column E
> >
> > Thefore the find Criteria would be Columns "A", "D", "E" then the
> > duplicates
> > found Delete.
> >
> > Sub DeleteTheOldies()
> > Dim RowNdx As Long
> > For RowNdx = Range("A1").End(xlDown).Row To 2 Step -1
> > If Cells(RowNdx, "A").Value = Cells(RowNdx - 1, "A").Value Then
> > If Cells(RowNdx, "D").Value <= Cells(RowNdx - 1, "D").Value Then
> > Rows(RowNdx).Delete
> > Else
> > Rows(RowNdx - 1).Delete
> > End If
> > End If
> > Next RowNdx
> > End Sub
> >
> > Thankyou

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop Access re-arranging query criteria onto multiple criteria lines for OR condition Chrisso Microsoft Access 3 9th Nov 2007 11:50 AM
Query with criteria for long data type but criteria is double =?Utf-8?B?THluZGE=?= Microsoft Access Queries 1 30th Jan 2007 01:24 AM
Selection.AutoFilter Field / Criteria => criteria sometimes non-existing on worksheet markx Microsoft Excel Programming 1 24th Nov 2006 02:52 PM
Counting Cells with multiple criteria.One criteria supporting wild =?Utf-8?B?QXpoYXIgQXJhaW4=?= Microsoft Excel Worksheet Functions 1 12th Jan 2005 08:33 AM
Re: have input box. Need criteria entered to refer to cond. format criteria Bob Phillips Microsoft Excel Programming 0 1st Mar 2004 08:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:55 AM.