Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default How find elements NOT common to two ranges?

Oops! I deleted too much.
I added the "On error" back here.

Function Complement(Rng1, Rng2)
'// Elements in Rng1 that are not in Rng2

Dim D
Dim C As Range

Set D = CreateObject("Scripting.Dictionary")
On Error Resume Next

For Each C In Rng1.Cells
If C < vbNullString Then D.Add C.Value, 1
Next C

For Each C In Rng2.Cells
If D.exists(C.Value) Then D.Remove (C.Value)
Next C

Complement = D.keys
End Function



= = =
Dana DeLouis

<snip
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
Combining two ranges based on common a common value ahmed[_3_] Excel Discussion (Misc queries) 5 April 18th 09 05:04 PM
Comparing two ranges of data and identify the common/like informat debra Excel Discussion (Misc queries) 2 April 1st 08 09:04 PM
Find rows with a common item and find or highlight difference jonnybrovo815 Excel Programming 2 February 27th 08 12:56 AM
Find Common names in multi ranges JG Excel Worksheet Functions 4 December 23rd 06 04:28 AM
How do I find the number of elements in an Array of Strings? BeefmanSteve Excel Programming 5 June 17th 05 12:48 AM


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