Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default union method for non-adjacent ranges

However, apparently the union statement cannot combine non-
adjacent ranges, but only adjacent ranges.


I believe that each argument to the MMult function requires a range with 1
area. It can not be two or more separate areas, even if the combined area
has the look of 1 area.
For an example, do a simple MMult on A2:A4, and B1:D1, but give the range
A2:A4 a range name like "xx".
Your function should work. Now, change the definition of "xx" to a range =
A2:A3,A4
Basically it's the same area, and it's the same cells. However, this has 2
areas, and therefore won't work.
Therefore, by using Union, you will have two areas, and this creates a
problem.
If you can combine them into 1 area, either as an array, or Range Name
formula, perhaps something similar to...

With Application.WorksheetFunction
[A1:C3] = .MMult(.Transpose(Array(1, 2, 3)), Array(4, 5, 6))
End With

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"felix" wrote in message
...
Hi there,

I am trying to combine two non-adjacent ranges. The
resulting range shall then be multiplied with another
range created the same way using the mmult worksheet
function.
However, apparently the union statement cannot combine non-
adjacent ranges, but only adjacent ranges.
I am running into this problem because I need to perform
matrix calculations with a matrix exceeding the 256
columns a worksheet provides.

Any help will be greatly appreciated!
Felix

Code

Note: a and cd are column ranges, b and ef are row ranges

Dim Result As Range
Set Result = Range("Result")
Dim a, b, cd, ef, acd, bef As Variant

Set a = Range("a")
Set b = Range("b")
Set cd = Range("cd")
Set ef = Range("ef")

acd = Union(a, cd)
bef = Union(b, ef)

Result = Application.WorksheetFunction.MMult(bef, acd)

End Sub



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
Quick question on naming a union of ranges [email protected] Excel Discussion (Misc queries) 2 July 29th 07 11:15 AM
printing Union of Ranges anny Excel Worksheet Functions 2 January 26th 06 10:22 AM
union method for non-adjacent ranges Tom Ogilvy Excel Programming 0 September 16th 03 02:21 PM
union method for non-adjacent ranges Jim Rech Excel Programming 0 September 16th 03 02:17 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 09:47 PM.

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"