Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Reciprocal range?

Suppose I have two ranges:

AllChildren = $B$1:$B$6
AllSons = $B$2, $B$4

And suppose that the children who aren't sons are daughters. **Without
looping** is there a way to return the range...
$B$1, $B$3, $B$5:$B$6
....for the daughters?

Thanks.

Charley


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reciprocal range?

There is no built in support for it.

Sub ReciprocalRange()
Dim AllChildren As String, AllSons As String
Dim allDaughters As String, sh As Worksheet
Dim sh1 As Worksheet, rng As Range
Dim rng1 As Range, rng2 As Range
Application.ScreenUpdating = False
AllChildren = "$B$1:$B$6"
AllSons = "$B$2,$B$4"

Set sh = ActiveSheet
Set sh1 = Worksheets.Add
Set rng = Range(AllChildren)
Set rng1 = Range(AllSons)

rng.Value = 1
rng1.ClearContents
Set rng2 = rng.SpecialCells(xlConstants, xlNumbers)
allDaughters = rng2.Address
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
sh.Activate
Application.ScreenUpdating = True
MsgBox allDaughters

End Sub

But it would probably be just as easy to loop.

--
Regards,
Tom Ogilvy


"Charley Kyd" wrote in message
...
Suppose I have two ranges:

AllChildren = $B$1:$B$6
AllSons = $B$2, $B$4

And suppose that the children who aren't sons are daughters. **Without
looping** is there a way to return the range...
$B$1, $B$3, $B$5:$B$6
...for the daughters?

Thanks.

Charley




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Reciprocal range?

Nuts.

Charley

"Tom Ogilvy" wrote in message
...
There is no built in support for it.

Sub ReciprocalRange()
Dim AllChildren As String, AllSons As String
Dim allDaughters As String, sh As Worksheet
Dim sh1 As Worksheet, rng As Range
Dim rng1 As Range, rng2 As Range
Application.ScreenUpdating = False
AllChildren = "$B$1:$B$6"
AllSons = "$B$2,$B$4"

Set sh = ActiveSheet
Set sh1 = Worksheets.Add
Set rng = Range(AllChildren)
Set rng1 = Range(AllSons)

rng.Value = 1
rng1.ClearContents
Set rng2 = rng.SpecialCells(xlConstants, xlNumbers)
allDaughters = rng2.Address
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
sh.Activate
Application.ScreenUpdating = True
MsgBox allDaughters

End Sub

But it would probably be just as easy to loop.

--
Regards,
Tom Ogilvy


"Charley Kyd" wrote in message
...
Suppose I have two ranges:

AllChildren = $B$1:$B$6
AllSons = $B$2, $B$4

And suppose that the children who aren't sons are daughters. **Without
looping** is there a way to return the range...
$B$1, $B$3, $B$5:$B$6
...for the daughters?

Thanks.

Charley






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Reciprocal range?

"Charley Kyd" wrote in message
...
Suppose I have two ranges:

AllChildren = $B$1:$B$6
AllSons = $B$2, $B$4

And suppose that the children who aren't sons are daughters.

**Without
looping** is there a way to return the range...
$B$1, $B$3, $B$5:$B$6
...for the daughters?

Thanks.

Charley




Charley,

http://tinyurl.com/2tfpb contains a couple examples that take
advantage of the SpecialCells method.


Hope this helps,

Mike


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Reciprocal range?

Thanks, Mike.

Charley

"Mike" wrote in message
news:7ho2c.27287$Bz3.19159@okepread05...
"Charley Kyd" wrote in message
...
Suppose I have two ranges:

AllChildren = $B$1:$B$6
AllSons = $B$2, $B$4

And suppose that the children who aren't sons are daughters.

**Without
looping** is there a way to return the range...
$B$1, $B$3, $B$5:$B$6
...for the daughters?

Thanks.

Charley




Charley,

http://tinyurl.com/2tfpb contains a couple examples that take
advantage of the SpecialCells method.


Hope this helps,

Mike






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
Non reciprocal formula? Tuk Excel Discussion (Misc queries) 1 November 15th 09 06:18 PM
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
How to count dates within a certain range in a column with mutiple date range entries Krisjhn Excel Worksheet Functions 2 September 1st 05 01:59 PM
how to? set my range= my UDF argument (range vs. value in range) [advanced?] Keith R[_3_] Excel Programming 2 August 11th 03 05:55 PM


All times are GMT +1. The time now is 02:44 PM.

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"