Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default union problem

the below source have problem.
i wanna be value of a11 ~ c12, as follow.
a11=2,b11=5,c11=9,a12=4,b12=7,c12=8

Sub rng_unio_ex()
Dim rng_source As Range, rng_source2 As Range
Set rng_source = Range("a7:c7")'a7=2,b7=5,c7=9
Set rng_source2 = Range("b9:d9")'b9=4,c9=7,d9=8

ReDim arry(1 To 2, 1 To 3) As Range

Set rng_unio = Union(rng_source, rng_source2)
For i = 1 To 2
For k = 1 To 3
m = m + 1
Set arry(i, k) = rng_unio(m)
Next
Next
Range("a11:c12").Value = arry
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default union problem

Certainly not a generalized solution, but this works:

Sub rng_unio_ex()
Dim rng_source As Range, rng_source2 As Range
Set rng_source = Range("a7:c7") 'a7=2,b7=5,c7=9
Set rng_source2 = Range("b9:d9") 'b9=4,c9=7,d9=8

ReDim arry(1 To 2, 1 To 3) As Range

Set rng_unio = Union(rng_source, rng_source2)
For i = 1 To 2
m = 0
For k = 1 To 3
m = m + 1
Set arry(i, k) = rng_unio.Areas(i)(m)
Next
Next
Range("a11:c12").Value = arry
End Sub

--
Regards,
Tom Ogilvy

"tom taol" wrote in message
...
the below source have problem.
i wanna be value of a11 ~ c12, as follow.
a11=2,b11=5,c11=9,a12=4,b12=7,c12=8

Sub rng_unio_ex()
Dim rng_source As Range, rng_source2 As Range
Set rng_source = Range("a7:c7")'a7=2,b7=5,c7=9
Set rng_source2 = Range("b9:d9")'b9=4,c9=7,d9=8

ReDim arry(1 To 2, 1 To 3) As Range

Set rng_unio = Union(rng_source, rng_source2)
For i = 1 To 2
For k = 1 To 3
m = m + 1
Set arry(i, k) = rng_unio(m)
Next
Next
Range("a11:c12").Value = arry
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default union problem



thnak you, Tom
happy one to you

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Help w/ Union Queries Jenn Excel Discussion (Misc queries) 1 January 12th 05 01:07 AM
Union question ToddG Excel Programming 3 June 25th 04 07:57 PM
Trouble with Union Ed Excel Programming 2 December 4th 03 07:30 PM
VBA union of two ranges s[_2_] Excel Programming 1 August 21st 03 02:18 AM


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