Hi Jay,
Can't say that I am sure that I really understand the question but perhaps
the following example might help.
Sub test2()
Dim rng1 As Range
Dim rng2 As Range
Dim rngUnion As Range
Dim isect As Range
Set rng1 = Range("A1:A2000")
Set rng2 = Range("C1:C2000")
Set rngUnion = Union(rng1, rng2)
MsgBox rngUnion.Address
Set isect = Intersect(rng1, rng2)
If isect Is Nothing Then
MsgBox "Ranges do NOT intersect"
Else
MsgBox "Ranges DO intersect"
End If
Set isect = Intersect(rng1, rngUnion)
If isect Is Nothing Then
MsgBox "Ranges do NOT intersect"
Else
MsgBox "Ranges DO intersectat " & isect.Address
End If
End Sub
--
Regards,
OssieMac
"jay dean" wrote:
Hello -
Is there a way to perform set operations in VBA? Example: If
rng1=Range("A1:A2000") and rng1=range("C1:C2000") containing strings --
numbers,text or both, is there a way to perform operations like
"intersection", "subset", and "union" that produces a range, containing
the result?
If not, can this be done with excel functions or formulas?
Any help will be appreciated!
Thanks
Jay
*** Sent via Developersdex http://www.developersdex.com ***