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: 25
Default Is it a duplicate row?

I am trying to determine if a row is a duplicate based on two criteria. This
is what I have so far, but it doesn't work. Any pointers much appreciated!

sub tester
Dim iLastRow As Long
Dim i As Long
Dim rName1 As Range
Dim rName2 As Range
Dim rTestRng As Range

iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 1 Step -1
' it's a dup if there are two rows in which columns C match AND
columns J ' match
Set rTestRng = Union(.Cells(i, "c"), .Cells(i, "j"))
If Application.CountIf(Union(.Range("c1:c" & iLastRow),
..Range("j1:j" & iLastRow)), rTestRng) = 2 Then
' do some stuff here
else ' do something else
end if
next i

end sub
 
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
duplicate name help please Terry Excel Worksheet Functions 9 February 20th 08 03:52 PM
Duplicate Alam Excel Discussion (Misc queries) 2 December 3rd 07 07:30 AM
How do you delete duplicate addresses, but keep duplicate names? Shelly Excel Discussion (Misc queries) 1 August 28th 06 10:36 PM
Duplicate Row parteegolfer Excel Programming 0 March 7th 06 01:46 AM
duplicate Metalteck Excel Discussion (Misc queries) 2 May 11th 05 10:04 PM


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

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"