View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Héctor Miguel Héctor Miguel is offline
external usenet poster
 
Posts: 434
Default opposite of Union

hi, Mark !

i'm afraid you need to "divorce" (or slice) that cell/range and make another union
(i.e.) using range objects (or adapt/modify/... to work with its address) -?-

Private Function Slice(Where As Range, Which As Range) As Range
Dim xCell As Range
For Each xCell In Where
If Intersect(xCell, Which) Is Nothing Then _
Set Slice = Union(IIf(Slice Is Nothing, xCell, Slice), xCell)
Next
End Function

hth,
hector.

__ OP __
I have a range name which defines a bunch of discontiguous cells... probably 100 or more.
Unfortunately, I have one cell, BR8, which is included in this defined range name, which should not be.
I've tried getting access to the address of all of the cells defined by this range name
so that I can have a program select all but that one, to redefine the range name.
But, the Selection.Address property, and the Names(i).RefersTo property only provide a small portion of the actual list of addresses involved.
What I'd like is the opposite of a Union..... sort of like an OppositeUnion(rgRange,"BR8")
which would deselect BR8 from the selection, so that I could then rename the proper set of cells.
I could go through and manually re-select all of the proper cells, but is there an easier way?