Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Undo a Union

What is the simplest way to undo a union?

I can expand a union with:

Set rng = UNION(rng,newstuff)

I want a function like:

Set rng=DIVORCE(rng, newstuff)

That will take rng and remove the range in newstuff.

Thanks in advance

--
Gary's Student
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Undo a Union

GS

There's no easy way, that I know. Here's a brute force method

http://www.dicks-blog.com/archives/2...the-selection/

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

Gary's Student wrote:
What is the simplest way to undo a union?

I can expand a union with:

Set rng = UNION(rng,newstuff)

I want a function like:

Set rng=DIVORCE(rng, newstuff)

That will take rng and remove the range in newstuff.

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Undo a Union

Function Disunion(rng As Range, NewStuff As Range) As Range
Dim rng1 As Range, cell As Range
For Each cell In rng
If Intersect(cell, NewStuff) Is Nothing Then
If rng1 Is Nothing Then
Set rng1 = cell
Else
Set rng1 = Union(cell, rng1)
End If
End If
Next
Set Disunion = rng1
End Function

This would only work if there is no intersection between the two ranges.

--
Regards,
Tom Ogilvy




"Gary's Student" wrote in message
...
What is the simplest way to undo a union?

I can expand a union with:

Set rng = UNION(rng,newstuff)

I want a function like:

Set rng=DIVORCE(rng, newstuff)

That will take rng and remove the range in newstuff.

Thanks in advance

--
Gary's Student



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Undo a Union

Thank you Tom. Its a neat idea. Re-creating the range cell-by-cell, but
execpting out the part I want to divorce.
--
Gary's Student


"Tom Ogilvy" wrote:

Function Disunion(rng As Range, NewStuff As Range) As Range
Dim rng1 As Range, cell As Range
For Each cell In rng
If Intersect(cell, NewStuff) Is Nothing Then
If rng1 Is Nothing Then
Set rng1 = cell
Else
Set rng1 = Union(cell, rng1)
End If
End If
Next
Set Disunion = rng1
End Function

This would only work if there is no intersection between the two ranges.

--
Regards,
Tom Ogilvy




"Gary's Student" wrote in message
...
What is the simplest way to undo a union?

I can expand a union with:

Set rng = UNION(rng,newstuff)

I want a function like:

Set rng=DIVORCE(rng, newstuff)

That will take rng and remove the range in newstuff.

Thanks in advance

--
Gary's Student




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Undo a Union

Hi,

how about this example (not simple at all...)

http://hp.vector.co.jp/authors/VA016...l/ununion2.txt

--
HTH,

okaizawa


Gary's Student wrote:
What is the simplest way to undo a union?

I can expand a union with:

Set rng = UNION(rng,newstuff)

I want a function like:

Set rng=DIVORCE(rng, newstuff)

That will take rng and remove the range in newstuff.

Thanks in advance

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
UNION of Arrays - is possible? Marina Limeira Excel Discussion (Misc queries) 1 January 22nd 06 12:38 PM
UNDO - how many times can I UNDO? Jane Excel Worksheet Functions 2 May 19th 05 03:03 AM
union problem tom taol Excel Programming 2 February 1st 05 08:43 AM
Why is my undo function in Excel only can undo the last 1 or 2 ch. 1111111111111111111111111111111111111111 Excel Worksheet Functions 1 November 24th 04 11:13 AM
Union question ToddG Excel Programming 3 June 25th 04 07:57 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"